This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add scoped
zone.js
support.The purpose of this PR is the same as this one #1073.
To allow
zone.js
only run inside ascope
. So inAngular Elements
, we can letzone.js
only work insideAngular Elements
without impacting outside world.monkey patch
every async APIs beforezone.run
remove monkey patch
afterzone.run
.This can work but have a performance impact, although
repatch
andremove patch
is onlyassign references
, but theamount
of the async APIs is a lot (espesiallyonProperty
), so there will be some performance loss.zone.run
, set a flagI am in the zone
.zone.run
, set a flagI am outside of zone
.And we still
monkey patch
all async APIs (but only once), it will look like this.For example,
setTimeout
.So we will wrap the
async API
, if currently, we are not inzone
, we will justuse the
native APIs
.So we don't have any performance loss when call
zone.run
.@mhevery, @robwormald, please review this idea is ok or not, I am adding test cases to make sure all
APIs
can work in both mode.If this idea is OK, we only need to do a simple
setup
to letAngular Elements
supportscoped zone
like this.That's all, please review, thank you.