once-events

1.0.0 • Public • Published

once-events Build Status

Wait for multiple DOM events

Install

$ npm install --save once-events

Usage

var onceEvents = require('once-events')
 
onceEvents([element1, element2], 'click', function (events) {
  //=> element1 click event is events[0]
  //=> element2 click event is events[1]
})

API

onceEvents(targets, event, callback) -> undefined

targets

Required
Type: array[eventTarget]

An array of DOM EventTargets.

event

Required
Type: string

The event to listen on.

callback

Required
Type: function
Arguments: events

A callback called with an array of events. The order matches the order of the targets, not the order in which the events ocurred.

License

MIT © Ben Drucker

Package Sidebar

Install

npm i once-events

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker