Skip to content

Instantly share code, notes, and snippets.

@arturovt
Created June 6, 2019 22:59
Show Gist options
  • Save arturovt/a1fc39136164331460e09c0063fdce55 to your computer and use it in GitHub Desktop.
Save arturovt/a1fc39136164331460e09c0063fdce55 to your computer and use it in GitHub Desktop.
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