fix: allow to disable load of polyfills

This commit is contained in:
Martin Guillon
2021-09-30 14:54:45 +02:00
parent 305d56453d
commit d8ca36a5ae
2 changed files with 17 additions and 15 deletions

View File

@ -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

View File

@ -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']);