Package Exports
- @telemok/event-target-strict
- @telemok/event-target-strict/lib/event-target-strict.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@telemok/event-target-strict) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
event-target-strict
Javascript ES6 EventTarget with .destroy() instead of .removeEventListener()
Features
- Javascript ES6 EventTarget with .destroy() instead of .removeEventListener()
Examples:
- Parsing students database
import { EventTargetStrict } from "@telemok/event-target-strict"
class Test extends EventTargetStrict
{
dispatch()
{
this.dispathEvent(new Event('example'));
}
}
class Component extends ***
{
constructor()
{
super();
this.test = new Test();
}
componentDidMount()
{
this.listener1 = this.test.addEventListener('example',(event)=>{
console.log("example-listener1");
});
this.listener2 = this.test.addEventListener('example',(event)=>{
console.log("example-listener2");
});
}
componentWillUnmount()
{
this.listener1.delete();
this.listener2.delete();
}
}