File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -90,15 +90,19 @@ A more structured version of zone-local storage tries to impose these two proper
9090To accomplish this, we build a subclass of ` Zone ` that takes care of these details for us:
9191
9292``` js
93+ const zoneProps = new WeakMap ();
94+
9395class ZoneWithStorage extends Zone {
9496 constructor (options , props = Object .create (null )) {
9597 super (options);
96- this . _props = Object .assign ({}, props); // or: use WeakMaps for integrity
98+ zoneProps . set ( this , Object .assign ({}, props));
9799 }
98100
99101 get (key ) {
100- if (key in this ._props ) {
101- return this ._props [key];
102+ const props = zoneProps .get (this );
103+
104+ if (key in props) {
105+ return props[key];
102106 }
103107
104108 if (this .parent instanceof ZoneWithStorage) {
You can’t perform that action at this time.
0 commit comments