Skip to content

Releases: browserify/events

v3.3.0

27 Feb 16:52
aed9f91
Compare
Choose a tag to compare
  • Support EventTarget emitters in events.once from Node.js 12.11.0.

    Now you can use the events.once function with objects that implement the EventTarget interface. This interface is used widely in
    the DOM and other web APIs.

    var events = require('events');
    var assert = require('assert');
    
    async function connect() {
      var ws = new WebSocket('wss://example.com');
      await events.once(ws, 'open');
      assert(ws.readyState === WebSocket.OPEN);
    }
    
    async function onClick() {
      await events.once(document.body, 'click');
      alert('you clicked the page!');
    }

v3.2.0

27 Feb 16:52
6f7f7db
Compare
Choose a tag to compare
  • 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.

v3.1.0

08 Jan 15:42
4f03fbf
Compare
Choose a tag to compare

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 nodejs/node@acc506c

  • Reduce code duplication in listener type check (#67 by @friederbluemle).

  • Improve emitter.once() performance in some engines

v3.0.0

25 May 10:04
d0e217c
Compare
Choose a tag to compare

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.

  • Update to events code from Node.js 10.x
    • (semver major) Adds off() method
  • Port more tests from Node.js
  • Switch browser tests to airtap, making things more reliable

v2.1.0

25 May 09:42
a627fd1
Compare
Choose a tag to compare
  • add Emitter#rawListeners from Node.js v9.4

v2.0.0

02 Feb 08:48
d9498a5
Compare
Choose a tag to compare
  • Update to events code from node.js 8.x
    • Adds prependListener() and prependOnceListener()
    • Adds eventNames() method
    • (semver major) Unwrap once() listeners in listeners()
  • copy tests from node.js

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.