Skip to content

Instantly share code, notes, and snippets.

@arturovt
Created June 6, 2019 22:59
Show Gist options
  • Save arturovt/83f5d7039887e607d03ac4cad19b636b to your computer and use it in GitHub Desktop.
Save arturovt/83f5d7039887e607d03ac4cad19b636b to your computer and use it in GitHub Desktop.
// Save the original reference to setTimeout
const originalSetTimeout = window.setTimeout;
// Overwrite the API with a function which wraps callback in zone
window.setTimeout = function(callback, delay) {
// Invoke the original API but wrap the callback in zone
return originalSetTimeout(
// Wrap the callback method
Zone.current.wrap(callback),
delay
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment