javascript - Use zone.js to detect current execution context from anywhere? -
with zone.js possible determine current execution context anywhere? ie., if zone-bound function calls function calls settimeout(myfn)
can determine current execution context within myfn()
? if so, please provide simple example of how so.
every time fork()
zone, accessing zone
object within zone's context return forked zone
.
the following experiment demonstrates behavior:
var b = function() { console.log('-->',zone) }; var = function() { settimeout(b,5); }; zone.fork().run(function() { zone.x = 'hi'; a(); }); settimeout(function() { console.log('==>', zone); }, 1); settimeout(function() { console.log('==>', zone); }, 10);
Comments
Post a Comment