package
Calls owner.addEventListener and returns a function to remove the listener
npm install @cfware/add-event-listenerGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
4.2 kB
Includes dependencies.
Calls owner.addEventListener and returns a function to remove the listener.
import addEventListener from '@cfware/add-event-listener';
class MyElement extends HTMLElement {
connectedCallback() {
this._cleanupFn = addEventListener(window, 'click', () => console.log('click'));
}
disconnectedCallback() {
this._cleanupFn();
}
}