(Zone: ZoneType)
| 39 | import {filterProperties, getOnEventNames} from './property-descriptor'; |
| 40 | |
| 41 | export function patchUtil(Zone: ZoneType): void { |
| 42 | Zone.__load_patch('util', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 43 | // Collect native event names by looking at properties |
| 44 | // on the global namespace, e.g. 'onclick'. |
| 45 | const eventNames: string[] = getOnEventNames(global); |
| 46 | api.patchOnProperties = patchOnProperties; |
| 47 | api.patchMethod = patchMethod; |
| 48 | api.bindArguments = bindArguments; |
| 49 | api.patchMacroTask = patchMacroTask; |
| 50 | // In earlier version of zone.js (<0.9.0), we use env name `__zone_symbol__BLACK_LISTED_EVENTS` |
| 51 | // to define which events will not be patched by `Zone.js`. In newer version (>=0.9.0), we |
| 52 | // change the env name to `__zone_symbol__UNPATCHED_EVENTS` to keep the name consistent with |
| 53 | // angular repo. The `__zone_symbol__BLACK_LISTED_EVENTS` is deprecated, but it is still be |
| 54 | // supported for backwards compatibility. |
| 55 | const SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS'); |
| 56 | const SYMBOL_UNPATCHED_EVENTS = Zone.__symbol__('UNPATCHED_EVENTS'); |
| 57 | if (global[SYMBOL_UNPATCHED_EVENTS]) { |
| 58 | global[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_UNPATCHED_EVENTS]; |
| 59 | } |
| 60 | if (global[SYMBOL_BLACK_LISTED_EVENTS]) { |
| 61 | (Zone as any)[SYMBOL_BLACK_LISTED_EVENTS] = (Zone as any)[SYMBOL_UNPATCHED_EVENTS] = |
| 62 | global[SYMBOL_BLACK_LISTED_EVENTS]; |
| 63 | } |
| 64 | api.patchEventPrototype = patchEventPrototype; |
| 65 | api.patchEventTarget = patchEventTarget; |
| 66 | api.ObjectDefineProperty = ObjectDefineProperty; |
| 67 | api.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor; |
| 68 | api.ObjectCreate = ObjectCreate; |
| 69 | api.ArraySlice = ArraySlice; |
| 70 | api.patchClass = patchClass; |
| 71 | api.wrapWithCurrentZone = wrapWithCurrentZone; |
| 72 | api.filterProperties = filterProperties; |
| 73 | api.attachOriginToPatched = attachOriginToPatched; |
| 74 | api._redefineProperty = Object.defineProperty; |
| 75 | api.patchCallbacks = patchCallbacks; |
| 76 | api.getGlobalObjects = () => ({ |
| 77 | globalSources, |
| 78 | zoneSymbolEventNames, |
| 79 | eventNames, |
| 80 | isBrowser, |
| 81 | isMix, |
| 82 | isNode, |
| 83 | TRUE_STR, |
| 84 | FALSE_STR, |
| 85 | ZONE_SYMBOL_PREFIX, |
| 86 | ADD_EVENT_LISTENER_STR, |
| 87 | REMOVE_EVENT_LISTENER_STR, |
| 88 | }); |
| 89 | }); |
| 90 | } |
no test coverage detected
searching dependent graphs…