New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

next-event

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-event

Call a function the next time a specific event is emitted

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

next-event

Call a function the next time a specific event is emitted

npm install next-event

build status

Basically like .once but faster.

Usage

var nextEvent = require('next-event')

var ontest = nextEvent(emitter, 'test')

ontest(function () {
  console.log('i am only called once')
})

emitter.emit('test')
emitter.emit('test')

Note that only the last function you pass to ontest in the above example will be called when the next event is emitted

ontest(function () {
  console.log('i am never called')
})

ontest(function () {
  console.log('i win because i was the last one')
})

emitter.test('test')

API

var once = nextEvent(emitter, name)

Create a new once function. Pass an event handler to once that should be called the next time name is emitted.

License

MIT

FAQs

Package last updated on 31 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts