feat: move ployfill to @ms/ployfill

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-02-01 02:40:39 +08:00
parent 8933afeb71
commit 57926ba788

View File

@ -1,22 +1,25 @@
(function(root, logger) {
// Init Global Value
global.root = root;
global.logger = logger;
// Init Global Function
global.noop = global.engineDisable = function() { };
global.engineLoad = load;
global.load = load = function __PreventGlobalLoadFunction__() {
throw new Error('Internal engine system not allow use `load` function!');
};
// Init console and require
global.XMLHttpRequest = undefined;
global.console = engineLoad(global.root + '/core/console.js')(logger);
global.require = engineLoad(global.root + '/core/require.js')(root);
// String contains ployfill
String.prototype.contains = function(searchString, position) {
return String.prototype.indexOf.call(this, searchString, position) > -1;
};
// ES6 Map Symbol ployfill
require('es6-map/implement');
require('es6-symbol/implement');
});
(
/**
* @param {string} root
* @param {any} logger
*/
function(root, logger) {
// Init Global Value
global.root = root;
global.logger = logger;
// Init Global Function
global.noop = global.engineDisable = function() { };
global.engineLoad = load;
global.load = load = function __PreventGlobalLoadFunction__() {
throw new Error('Internal engine system not allow use `load` function!');
}
global.NashornEngineStartTime = new Date().getTime()
// Init console and require
global.setGlobal = function(key, value) {
global[key] = value;
}
global.console = engineLoad(global.root + '/core/console.js')(logger);
global.require = engineLoad(global.root + '/core/require.js')(root);
require('@ms/ployfill')
}
);