next-event

WebJar for next-event

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

next-event
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

next-event
WebJar for next-event
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mafintosh/next-event

Download next-event

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/next-event/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>next-event</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/next-event/
implementation 'org.webjars.npm:next-event:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/next-event/
implementation ("org.webjars.npm:next-event:1.0.0")
'org.webjars.npm:next-event:jar:1.0.0'
<dependency org="org.webjars.npm" name="next-event" rev="1.0.0">
  <artifact name="next-event" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='next-event', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "next-event" % "1.0.0"
[org.webjars.npm/next-event "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

next-event

Call a function the next time a specific event is emitted

npm install next-event

build status

Basically like .once but faster since it won't gc the event handler on every event.

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

Versions

Version
1.0.0