JSPM

@telemok/event-target-strict

0.0.7
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q46668F
  • License Apache-2.0

Javascript ES6 EventTarget with .destroy() instead of .removeEventListener()

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:

  1. 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();
  }
}