init commit

This commit is contained in:
iqudoo
2026-04-30 10:16:43 +08:00
commit 2c8eb4f587
44 changed files with 17574 additions and 0 deletions

31
src/polyfill/_es6.js Normal file
View File

@@ -0,0 +1,31 @@
import { polyfill } from 'es6-promise';
// Object.assign
if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
polyfill();

24
src/polyfill/_global.js Normal file
View File

@@ -0,0 +1,24 @@
let _global = {};
// global
if (typeof GameGlobal !== 'undefined') {
_global = Object.assign({}, GameGlobal);
} else if (typeof window === 'undefined') {
_global = {
setTimeout: (...params) => {
return setTimeout(...params);
},
setInterval: (...params) => {
return setInterval(...params);
},
clearTimeout: (...params) => {
return clearTimeout(...params);
},
clearInterval: (...params) => {
return clearInterval(...params);
}
};
} else {
_global = window;
}
export default _global;

2
src/polyfill/index.js Normal file
View File

@@ -0,0 +1,2 @@
import './_global';
import './_es6';