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

set custom global zone #995

Closed
matthewjh opened this issue Jan 19, 2018 · 4 comments
Closed

set custom global zone #995

matthewjh opened this issue Jan 19, 2018 · 4 comments

Comments

@matthewjh
Copy link
Contributor

matthewjh commented Jan 19, 2018

Hello,

In my use case, I need to have a custom global zone. I want my own zone's hooks to be run, even when not using zone.run. Basically I need to replace the default Zone.current with my own zone, and use that as the "default" zone.

Is there any way to do this?

Thanks,
Matt

@JiaLiPassion
Copy link
Collaborator

@matthewjh , no, it is not supported.
there was the same requirement before, #513. you can check the answer there.

@matthewjh
Copy link
Contributor Author

@JiaLiPassion: Damn, that is a shame.

@mleibman
Copy link
Contributor

You can always just monkey patch it.
Something like this for runTask, and similar wrappers for the rest as needed:

const runTask = Zone.prototype.runTask;
Zone.prototype.runTask = function(task, applyThis, applyArgs) {
  // Run your own handlers.
  return runTask.call(this, task, applyThis, applyArgs);
};

JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Feb 23, 2018
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Feb 23, 2018
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Feb 23, 2018
@JiaLiPassion
Copy link
Collaborator

Will close this for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants