Skip to content

Commit

Permalink
fix(zone.js): __load_patch and __symbol__ should be in zone_extern fo…
Browse files Browse the repository at this point in the history
…r closure compiler (angular#31350)

PR Close angular#31350
  • Loading branch information
JiaLiPassion authored and sabeersulaiman committed Sep 6, 2019
1 parent 67153c0 commit eade97e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/zone.js/lib/closure/zone_externs.js
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions packages/zone.js/lib/zone.ts
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions packages/zone.js/test/closure/zone.closure.ts
Expand Up @@ -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(() => {
Expand Down

0 comments on commit eade97e

Please sign in to comment.