feat(zone.js): move MutationObserver/FileReader to different module (#31657)
Separate `EventTarget`, `FileReader`, `MutationObserver` and `IntersectionObserver` patches into different module. So the user can disable those modules separately. PR Close #31657
This commit is contained in:
parent
6e2db228af
commit
253337dc0a
|
@ -36,6 +36,10 @@ Below is the full list of currently supported modules.
|
|||
|requestAnimationFrame|requestAnimationFrame will be patched as Zone MacroTask|__Zone_disable_requestAnimationFrame = true|
|
||||
|blocking|alert/prompt/confirm will be patched as Zone.run|__Zone_disable_blocking = true|
|
||||
|EventTarget|target.addEventListener will be patched as Zone aware EventTask|__Zone_disable_EventTarget = true|
|
||||
|MutationObserver|MutationObserver will be patched as Zone aware operation|__Zone_disable_MutationObserver = true|
|
||||
|IntersectionObserver|Intersection will be patched as Zone aware operation|__Zone_disable_Intersection = true|
|
||||
|FileReader|FileReader will be patched as Zone aware operation|__Zone_disable_FileReader = true|
|
||||
|canvas|HTMLCanvasElement.toBlob will be patched as Zone aware operation|__Zone_disable_canvas = true|
|
||||
|IE BrowserTools check|in IE, browser tool will not use zone patched eventListener|__Zone_disable_IE_check = true|
|
||||
|CrossContext check|in webdriver, enable check event listener is cross context|__Zone_enable_cross_context_check = true|
|
||||
|XHR|XMLHttpRequest will be patched as Zone aware MacroTask|__Zone_disable_XHR = true|
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
import {findEventTasks} from '../common/events';
|
||||
import {patchTimer} from '../common/timers';
|
||||
import {patchClass, patchMethod, patchPrototype, scheduleMacroTaskWithCurrentZone, ZONE_SYMBOL_ADD_EVENT_LISTENER, ZONE_SYMBOL_REMOVE_EVENT_LISTENER, zoneSymbol} from '../common/utils';
|
||||
import {patchClass, patchMethod, patchPrototype, scheduleMacroTaskWithCurrentZone, ZONE_SYMBOL_ADD_EVENT_LISTENER, ZONE_SYMBOL_REMOVE_EVENT_LISTENER, zoneSymbol,} from '../common/utils';
|
||||
|
||||
import {patchCustomElements} from './custom-elements';
|
||||
import {eventTargetPatch, patchEvent} from './event-target';
|
||||
|
@ -59,9 +59,18 @@ Zone.__load_patch('EventTarget', (global: any, Zone: ZoneType, api: _ZonePrivate
|
|||
if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {
|
||||
api.patchEventTarget(global, [XMLHttpRequestEventTarget.prototype]);
|
||||
}
|
||||
});
|
||||
|
||||
Zone.__load_patch('MutationObserver', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
|
||||
patchClass('MutationObserver');
|
||||
patchClass('WebKitMutationObserver');
|
||||
});
|
||||
|
||||
Zone.__load_patch('IntersectionObserver', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
|
||||
patchClass('IntersectionObserver');
|
||||
});
|
||||
|
||||
Zone.__load_patch('FileReader', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
|
||||
patchClass('FileReader');
|
||||
});
|
||||
|
||||
|
|
|
@ -325,6 +325,21 @@ interface ZoneGlobalConfigurations {
|
|||
*/
|
||||
__Zone_disable_EventTarget?: boolean;
|
||||
|
||||
/**
|
||||
* Disable the monkey patch of the browser `FileReader` APIs.
|
||||
*/
|
||||
__Zone_disable_FileReader?: boolean;
|
||||
|
||||
/**
|
||||
* Disable the monkey patch of the browser `MutationObserver` APIs.
|
||||
*/
|
||||
__Zone_disable_MutationObserver?: boolean;
|
||||
|
||||
/**
|
||||
* Disable the monkey patch of the browser `IntersectionObserver` APIs.
|
||||
*/
|
||||
__Zone_disable_IntersectionObserver?: boolean;
|
||||
|
||||
/**
|
||||
* Disable the monkey patch of the browser onProperty APIs(such as onclick).
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue