seng-disposable-event-listener
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

seng-disposable-event-listener

The addEventListener is a wrapper around the native addEventListener method, which makes it easier to remove it. By calling this function, the listener is removed

Installation

yarn / npm

yarn add seng-disposable-event-listener
npm i -S seng-disposable-event-listener

Usage

Constructing.

  const windowResizeListener = addEventListener(
    window,
    resize',
    this.handleResize.bind(this)
  );

Disposing

  windowResizeListener();

Building

In order to build seng-disposable-event-listener, ensure that you have Git and [Node.js] (http://nodejs .org/) installed.

Clone a copy of the repo:

git clone https://github.com/riccomediamonks/seng-disposable-event-listener.git

Change to the seng-disposable-event-listener directory:

cd seng-disposable-event-listener

Install dev dependencies:

yarn

Use one of the following main scripts:

yarn build           # build this project 
yarn dev             # run dev-watch mode, serving example/index.html in the browser 
yarn generate        # generate all artifacts (compiles ts, webpack, docs and coverage) 
yarn test:unit       # run the unit tests 
yarn validate        # runs validation scripts, including test, lint and coverage check 
yarn lint            # run tslint on this project 
yarn doc             # generate typedoc documentation 

When installing this module, it adds a pre-push hook, that runs the validate script before committing, so you can be sure that everything checks out.

Package Sidebar

Install

npm i seng-disposable-event-listener

Weekly Downloads

188

Version

2.0.1

License

MIT

Unpacked Size

10 kB

Total Files

11

Last publish

Collaborators

  • riccoarntz