mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
fix: allow to disable load of polyfills
This commit is contained in:
2
packages/core/global-types.d.ts
vendored
2
packages/core/global-types.d.ts
vendored
@ -122,7 +122,7 @@ declare namespace NodeJS {
|
||||
TNS_WEBPACK?: boolean;
|
||||
isIOS?: boolean;
|
||||
isAndroid?: boolean;
|
||||
autoRegisterUIModules?: boolean;
|
||||
autoLoadPolyfills?: boolean;
|
||||
__requireOverride?: (name: string, dir: string) => any;
|
||||
|
||||
// used to get the rootlayout instance to add/remove childviews
|
||||
|
@ -301,26 +301,28 @@ export function initGlobal() {
|
||||
};
|
||||
|
||||
// DOM api polyfills
|
||||
// global.registerModule('timer', () => require('../timer'));
|
||||
// installPolyfills('timer', ['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval']);
|
||||
if (global.autoLoadPolyfills !== false) {
|
||||
global.registerModule('timer', () => require('../timer'));
|
||||
installPolyfills('timer', ['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval']);
|
||||
|
||||
// global.registerModule('animation', () => require('../animation-frame'));
|
||||
// installPolyfills('animation', ['requestAnimationFrame', 'cancelAnimationFrame']);
|
||||
global.registerModule('animation', () => require('../animation-frame'));
|
||||
installPolyfills('animation', ['requestAnimationFrame', 'cancelAnimationFrame']);
|
||||
|
||||
// global.registerModule('ui-dialogs', () => require('../ui/dialogs'));
|
||||
// installPolyfills('ui-dialogs', ['alert', 'confirm', 'prompt', 'login', 'action']);
|
||||
global.registerModule('ui-dialogs', () => require('../ui/dialogs'));
|
||||
installPolyfills('ui-dialogs', ['alert', 'confirm', 'prompt', 'login', 'action']);
|
||||
|
||||
// global.registerModule('text', () => require('../text'));
|
||||
// installPolyfills('text', ['TextDecoder', 'TextEncoder']);
|
||||
global.registerModule('text', () => require('../text'));
|
||||
installPolyfills('text', ['TextDecoder', 'TextEncoder']);
|
||||
|
||||
// global.registerModule('xhr', () => require('../xhr'));
|
||||
// installPolyfills('xhr', ['XMLHttpRequest', 'Blob', 'File', 'FileReader']);
|
||||
global.registerModule('xhr', () => require('../xhr'));
|
||||
installPolyfills('xhr', ['XMLHttpRequest', 'Blob', 'File', 'FileReader']);
|
||||
|
||||
// global.registerModule('formdata', () => require('../polyfills/formdata'));
|
||||
// installPolyfills('formdata', ['FormData']);
|
||||
global.registerModule('formdata', () => require('../polyfills/formdata'));
|
||||
installPolyfills('formdata', ['FormData']);
|
||||
|
||||
// global.registerModule('fetch', () => require('../fetch'));
|
||||
// installPolyfills('fetch', ['fetch', 'Headers', 'Request', 'Response']);
|
||||
global.registerModule('fetch', () => require('../fetch'));
|
||||
installPolyfills('fetch', ['fetch', 'Headers', 'Request', 'Response']);
|
||||
}
|
||||
|
||||
// global.registerModule('abortcontroller', () => require('../abortcontroller'));
|
||||
// installPolyfills('abortcontroller', ['AbortController', 'AbortSignal']);
|
||||
|
Reference in New Issue
Block a user