Skip to content

Commit 6b51ed2

Browse files
JiaLiPassionmhevery
authored andcommitted
fix(zone.js): __load_patch and __symbol__ should be in zone_extern for closure compiler (#31350)
PR Close #31350
1 parent b696413 commit 6b51ed2

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

packages/zone.js/lib/closure/zone_externs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ Zone.prototype.name;
2727

2828
Zone.assertZonePatched = function() {};
2929

30+
Zone.__symbol__ = function(name) {};
31+
32+
Zone.__load_patch = function(name, fn) {};
33+
3034
/**
3135
* @type {!Zone} Returns the current [Zone]. Returns the current zone. The only way to change
3236
* the current zone is by invoking a run() method, which will update the current zone for the

packages/zone.js/lib/zone.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,15 @@ interface ZoneType {
309309
*/
310310
root: Zone;
311311

312-
/** @internal */
312+
/**
313+
* load patch for specified native module, allow user to
314+
* define their own patch, user can use this API after loading zone.js
315+
*/
313316
__load_patch(name: string, fn: _PatchFn): void;
314317

315-
/** Was @ internal but this prevents compiling tests as separate unit */
318+
/**
319+
* Zone symbol API to generate a string with __zone_symbol__ prefix
320+
*/
316321
__symbol__(name: string): string;
317322
}
318323

packages/zone.js/test/closure/zone.closure.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ const testClosureFunction = () => {
5252
}
5353
};
5454

55+
Zone.__load_patch('test_closure_load_patch', function() {});
56+
Zone.__symbol__('test_symbol');
57+
5558
const testZone: Zone = Zone.current.fork(testZoneSpec);
5659
testZone.runGuarded(() => {
5760
testZone.run(() => {

0 commit comments

Comments
 (0)