Snippets Collections
const controller = new AbortController();
const { signal } = controller;

element.addEventListener('click', () => {
  // do whatever 
}, { signal }); 

teardown() {
  super.teardown();
  controller.abort();
}
star

Thu Mar 02 2023 05:29:10 GMT+0000 (Coordinated Universal Time)

#controller #signal #stop #eventlistener #abort

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension