There are four lifecycle hooks for asynchronous operations from zone.js.
onScheduleTask: function(delegate, curr, target, task) { console.log('new task is scheduled:', task.type, task.source); return delegate.scheduleTask(target, task); }
onInvokeTask: function(delegate, curr, target, task, applyThis, applyArgs) { console.log('task will be invoked:', task.type, task.source); return delegate.invokeTask(target, task, applyThis, applyArgs); }
onHasTask: function(delegate, curr, target, hasTaskState) { console.log('task state changed in the zone:', hasTaskState); return delegate.hasTask(target, hasTaskState); }
onInvoke: function(delegate, curr, target, callback, applyThis, applyArgs) { console.log('the callback will be invoked:', callback); return delegate.invoke(target, callback, applyThis, applyArgs); }