Skip to content

Instantly share code, notes, and snippets.

@Sohail05
Created June 2, 2021 14:44
Show Gist options
  • Save Sohail05/4cdee93f7e3006310e2b9ad0f81237b3 to your computer and use it in GitHub Desktop.
Save Sohail05/4cdee93f7e3006310e2b9ad0f81237b3 to your computer and use it in GitHub Desktop.
Hot Module Reload - Clear intervals
const observer = new MutationObserver((_m, _o) => {
const hmr = _m.some((m) => {
return m.attributeName === "data-hmr";
})
if (!hmr) {
return
}
//Remove previous Intervals & Timeouts
//clearInterval();
observer.disconnect();
});
observer.observe(this.el, { attributes: true, childList: false, subtree: false });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment