Changelog
3.2.0
Add events.once
from Node.js 11.13.0.
To use this function, Promises must be supported in the environment. Use a polyfill like es6-promise
if you support older browsers.
Changelog
3.1.0 (2020-01-08)
events
now matches the Node.js 11.12.0 API.
pass through return value in wrapped emitter.once()
listeners
Now, this works:
emitter.once('myevent', function () { return 1; });
var listener = emitter.rawListeners('myevent')[0]
assert(listener() === 1);
Previously, listener()
would return undefined regardless of the implementation.
Ported from https://github.com/nodejs/node/commit/acc506c2d2771dab8d7bba6d3452bc5180dff7cf
Reduce code duplication in listener type check (#67 by @friederbluemle).
Improve emitter.once()
performance in some engines
Changelog
3.0.0 (2018-05-25)
This version drops support for IE8. events
no longer includes polyfills
for ES5 features. If you need to support older environments, use an ES5 shim
like es5-shim. Both the shim and sham
versions of es5-shim are necessary.
off()
methodChangelog
2.1.0 (2018-05-25)
Changelog
2.0.0 (2018-02-02)
prependListener()
and prependOnceListener()
eventNames()
methodonce()
listeners in listeners()
Note that this version doubles the gzipped size, jumping from 1.1KB to 2.1KB, due to new methods and runtime performance improvements. Be aware of that when upgrading.
Changelog
1.1.1 (2016-06-22)
Changelog
1.1.0 (2015-09-29)