Created
June 6, 2019 22:59
-
-
Save arturovt/a1fc39136164331460e09c0063fdce55 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import 'zone.js'; | |
import * as library from 'external-library'; | |
const zone = Zone.current.fork({ | |
name: 'myAwesomeZone', | |
onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => { | |
console.log('Preparing to run some "then" callback...'); | |
return delegate.invokeTask(target, task, applyThis, applyArgs); | |
}, | |
onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => { | |
console.log('Callback will be run: ', callback); | |
console.log(`Let's do something before the callback is invoked...`); | |
doMyAmazingStuffHere(); | |
return delegate.invoke(target, callback, applyThis, applyArgs, source); | |
} | |
}); | |
zone.run(() => { | |
library.someAwesomeFunction(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment