Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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