Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 9c65d25

Browse files
JiaLiPassionIgorMinar
authored andcommittedFeb 28, 2019
env: change BLACK_LISTED_EVENTS to DISABLE_EVENTS
1 parent 2ad936b commit 9c65d25

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed
 

‎lib/browser/api-util.ts

+15
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,19 @@ Zone.__load_patch('util', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
1313
api.patchMethod = patchMethod;
1414
api.bindArguments = bindArguments;
1515
api.patchMacroTask = patchMacroTask;
16+
// In earlier version of zone.js (<0.9.0), we use env name `__zone_symbol__BLACK_LISTED_EVENTS` to
17+
// define which events will not be patched by `Zone.js`.
18+
// In newer version (>=0.9.0), we change the env name to `__zone_symbol__UNPATCHED_EVENTS` to keep
19+
// the name consistent with angular repo.
20+
// The `__zone_symbol__BLACK_LISTED_EVENTS` is deprecated, but it is still be supported for
21+
// backwards compatibility.
22+
const SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS');
23+
const SYMBOL_UNPATCHED_EVENTS = Zone.__symbol__('UNPATCHED_EVENTS');
24+
if (global[SYMBOL_UNPATCHED_EVENTS]) {
25+
global[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_UNPATCHED_EVENTS];
26+
}
27+
if (global[SYMBOL_BLACK_LISTED_EVENTS]) {
28+
(Zone as any)[SYMBOL_BLACK_LISTED_EVENTS] = (Zone as any)[SYMBOL_UNPATCHED_EVENTS] =
29+
global[SYMBOL_BLACK_LISTED_EVENTS];
30+
}
1631
});

‎lib/browser/browser-legacy.ts

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ Zone.__load_patch('registerElement', (global: any, Zone: ZoneType, api: _ZonePri
1919
});
2020

2121
Zone.__load_patch('EventTargetLegacy', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
22-
const SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS');
23-
if (global[SYMBOL_BLACK_LISTED_EVENTS]) {
24-
(Zone as any)[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_BLACK_LISTED_EVENTS];
25-
}
2622
eventTargetLegacyPatch(global, api);
2723
propertyDescriptorLegacyPatch(api, global);
2824
});

‎lib/browser/browser.ts

-6
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ Zone.__load_patch('blocking', (global: any, Zone: ZoneType) => {
4747
});
4848

4949
Zone.__load_patch('EventTarget', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
50-
// load blackListEvents from global
51-
const SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS');
52-
if (global[SYMBOL_BLACK_LISTED_EVENTS]) {
53-
(Zone as any)[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_BLACK_LISTED_EVENTS];
54-
}
55-
5650
patchEvent(global, api);
5751
eventTargetPatch(global, api);
5852
// patch XMLHttpRequestEventTarget's addEventListener/removeEventListener

‎test/test_fake_polyfill.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ Object.defineProperties(TestTarget.prototype, {
7575
global['__Zone_ignore_on_properties'] =
7676
[{target: TestTarget.prototype, ignoreProperties: ['prop1']}];
7777
global['__zone_symbol__FakeAsyncTestMacroTask'] = [{source: 'TestClass.myTimeout'}];
78-
global['__zone_symbol__BLACK_LISTED_EVENTS'] = ['scroll'];
78+
global['__zone_symbol__UNPATCHED_EVENTS'] = ['scroll'];
7979
})(typeof window === 'object' && window || typeof self === 'object' && self || global);

0 commit comments

Comments
 (0)
This repository has been archived.