-
Notifications
You must be signed in to change notification settings - Fork 408
WIP(core): Proposal: can unload, reload patch modules #1159
base: master
Are you sure you want to change the base?
Conversation
The idea of #1073 is, Use case: only run specified code into zone.const zone = Zone.current.fork({name: 'zone'});
zone.run(() => {setTimeout(() => {
console.log('zone', Zone.current.name); // will run into zone
})});
setTimeout(() => {
console.log('zone', Zone.current); // will run into root zone in current version.
}, 100); for example, in current version, the code above, the 1st setTimeout will run into in this PR proposal, only Use case: such as angular elements to implement WebComponent. Only run logic with
|
Can this behavior be configurable? |
@mleibman, yes, this |
9f5d2e8
to
5eccff6
Compare
The same idea with #1073.
In 1073, there is some performance concern, I used a more simple logic to implement this in this PR, every time only need to do a
small loop
and justreset reference
. I did some basic benchmark.It will only cost
0.000022ms
every timeunload/reload
all the patches, so I think basicallyno cost
With this PR, we can run
zone.js
only insideAngular Elements
, and don't impact outside ofAngular Elements
.@mhevery, @robwormald, please review. Thank you!