Created
July 10, 2018 08:21
-
-
Save JiaLiPassion/5b4b8b502aa7817f8fcf6d6be359a49f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currentZoneFrame = {zone: root, parent: null}; | |
class Zone { | |
static get current() { | |
return currentZoneFrame.zone; | |
} | |
run(callback, applyThis, applyArgs) { | |
_currentZoneFrame = {parent: _currentZoneFrame, zone: this}; | |
try { | |
return callback.apply(applyThis, applyArgs); | |
} finally { | |
_currentZoneFrame = _currentZoneFrame.parent; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The global variable must begin with an underscore.