fix(zone.js): __load_patch and __symbol__ should be in zone_extern for closure compiler (#31350)

PR Close #31350
This commit is contained in:
JiaLiPassion 2019-06-29 12:29:29 +07:00 committed by Miško Hevery
parent b696413a79
commit 6b51ed29ef
3 changed files with 14 additions and 2 deletions

View File

@ -27,6 +27,10 @@ Zone.prototype.name;
Zone.assertZonePatched = function() {};
Zone.__symbol__ = function(name) {};
Zone.__load_patch = function(name, fn) {};
/**
* @type {!Zone} Returns the current [Zone]. Returns the current zone. The only way to change
* the current zone is by invoking a run() method, which will update the current zone for the

View File

@ -309,10 +309,15 @@ interface ZoneType {
*/
root: Zone;
/** @internal */
/**
* load patch for specified native module, allow user to
* define their own patch, user can use this API after loading zone.js
*/
__load_patch(name: string, fn: _PatchFn): void;
/** Was @ internal but this prevents compiling tests as separate unit */
/**
* Zone symbol API to generate a string with __zone_symbol__ prefix
*/
__symbol__(name: string): string;
}

View File

@ -52,6 +52,9 @@ const testClosureFunction = () => {
}
};
Zone.__load_patch('test_closure_load_patch', function() {});
Zone.__symbol__('test_symbol');
const testZone: Zone = Zone.current.fork(testZoneSpec);
testZone.runGuarded(() => {
testZone.run(() => {