12
12
13
13
import { findEventTasks } from '../common/events' ;
14
14
import { patchTimer } from '../common/timers' ;
15
- import { bindArguments , patchClass , patchMacroTask , patchMethod , patchOnProperties , patchPrototype , scheduleMacroTaskWithCurrentZone , ZONE_SYMBOL_ADD_EVENT_LISTENER , ZONE_SYMBOL_REMOVE_EVENT_LISTENER , zoneSymbol } from '../common/utils' ;
15
+ import { bindArguments , patchClass , patchMacroTask , patchMethod , patchOnProperties , patchPrototype , scheduleMacroTaskWithCurrentZone , ZONE_SYMBOL_ADD_EVENT_LISTENER , ZONE_SYMBOL_REMOVE_EVENT_LISTENER , zoneSymbol , createConstructorFunctionWrapper , createShallowObjectCopy , ObjectGetPrototypeOf } from '../common/utils' ;
16
16
17
17
import { propertyPatch } from './define-property' ;
18
18
import { eventTargetPatch , patchEvent } from './event-target' ;
@@ -58,6 +58,15 @@ Zone.__load_patch('EventTarget', (global: any, Zone: ZoneType, api: _ZonePrivate
58
58
( Zone as any ) [ SYMBOL_BLACK_LISTED_EVENTS ] = global [ SYMBOL_BLACK_LISTED_EVENTS ] ;
59
59
}
60
60
61
+ global [ 'Event' ] = createConstructorFunctionWrapper ( global [ 'Event' ] ) ;
62
+ global [ 'EventTarget' ] = createConstructorFunctionWrapper ( global [ 'EventTarget' ] ) ;
63
+
64
+ if ( global [ 'XMLHttpRequestEventTarget' ] && global [ 'XMLHttpRequestEventTarget' ] . prototype ) {
65
+ const XMLHttpRequestEventTargetProtoProto = createShallowObjectCopy ( ObjectGetPrototypeOf ( global [ 'XMLHttpRequestEventTarget' ] . prototype ) ) ;
66
+ global [ 'XMLHttpRequestEventTarget' ] = createConstructorFunctionWrapper ( global [ 'XMLHttpRequestEventTarget' ] ) ;
67
+ ( Object as any ) . setPrototypeOf ( global [ 'XMLHttpRequestEventTarget' ] . prototype , XMLHttpRequestEventTargetProtoProto ) ;
68
+ }
69
+
61
70
patchEvent ( global , api ) ;
62
71
eventTargetPatch ( global , api ) ;
63
72
// patch XMLHttpRequestEventTarget's addEventListener/removeEventListener
@@ -78,6 +87,8 @@ Zone.__load_patch('on_property', (global: any, Zone: ZoneType, api: _ZonePrivate
78
87
} ) ;
79
88
80
89
Zone . __load_patch ( 'canvas' , ( global : any ) => {
90
+ global [ 'HTMLCanvasElement' ] = createConstructorFunctionWrapper ( global [ 'HTMLCanvasElement' ] ) ;
91
+
81
92
const HTMLCanvasElement = global [ 'HTMLCanvasElement' ] ;
82
93
if ( typeof HTMLCanvasElement !== 'undefined' && HTMLCanvasElement . prototype &&
83
94
HTMLCanvasElement . prototype . toBlob ) {
0 commit comments