singleton-dom-events

1.2.0 • Public • Published

singleton-dom-events npm version js-standard-style

DOM event manager that strictly allows one event per identifier. It simply stores the elements and callbacks based on the passed identifier and ensures they are removed before (re-)adding them.

install

npm i singleton-dom-events --save

api / function signature

  • identifier (String [unique identifier for event] - required)
  • element (DOM element - required)
  • eventName (String - required)
  • callback (Function - required)
  • useCapture (Boolean - optional)

usage

Example

const setEvent = require('singleton-dom-events')

let myCb = => console.log('yay')

setEvent('window-resize', window, 'resize', myCb)
setEvent.remove('window-resize')

Readme

Keywords

Package Sidebar

Install

npm i singleton-dom-events

Weekly Downloads

1

Version

1.2.0

License

MIT

Unpacked Size

2.89 kB

Total Files

3

Last publish

Collaborators

  • doesdev