web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.2 KiB

  1. # 3.3.0
  2. - Support EventTarget emitters in `events.once` from Node.js 12.11.0.
  3. Now you can use the `events.once` function with objects that implement the EventTarget interface. This interface is used widely in
  4. the DOM and other web APIs.
  5. ```js
  6. var events = require('events');
  7. var assert = require('assert');
  8. async function connect() {
  9. var ws = new WebSocket('wss://example.com');
  10. await events.once(ws, 'open');
  11. assert(ws.readyState === WebSocket.OPEN);
  12. }
  13. async function onClick() {
  14. await events.once(document.body, 'click');
  15. alert('you clicked the page!');
  16. }
  17. ```
  18. # 3.2.0
  19. - Add `events.once` from Node.js 11.13.0.
  20. To use this function, Promises must be supported in the environment. Use a polyfill like `es6-promise` if you support older browsers.
  21. # 3.1.0 (2020-01-08)
  22. `events` now matches the Node.js 11.12.0 API.
  23. - pass through return value in wrapped `emitter.once()` listeners
  24. Now, this works:
  25. ```js
  26. emitter.once('myevent', function () { return 1; });
  27. var listener = emitter.rawListeners('myevent')[0]
  28. assert(listener() === 1);
  29. ```
  30. Previously, `listener()` would return undefined regardless of the implementation.
  31. Ported from https://github.com/nodejs/node/commit/acc506c2d2771dab8d7bba6d3452bc5180dff7cf
  32. - Reduce code duplication in listener type check ([#67](https://github.com/Gozala/events/pull/67) by [@friederbluemle](https://github.com/friederbluemle)).
  33. - Improve `emitter.once()` performance in some engines
  34. # 3.0.0 (2018-05-25)
  35. **This version drops support for IE8.** `events` no longer includes polyfills
  36. for ES5 features. If you need to support older environments, use an ES5 shim
  37. like [es5-shim](https://npmjs.com/package/es5-shim). Both the shim and sham
  38. versions of es5-shim are necessary.
  39. - Update to events code from Node.js 10.x
  40. - (semver major) Adds `off()` method
  41. - Port more tests from Node.js
  42. - Switch browser tests to airtap, making things more reliable
  43. # 2.1.0 (2018-05-25)
  44. - add Emitter#rawListeners from Node.js v9.4
  45. # 2.0.0 (2018-02-02)
  46. - Update to events code from node.js 8.x
  47. - Adds `prependListener()` and `prependOnceListener()`
  48. - Adds `eventNames()` method
  49. - (semver major) Unwrap `once()` listeners in `listeners()`
  50. - copy tests from node.js
  51. Note that this version doubles the gzipped size, jumping from 1.1KB to 2.1KB,
  52. due to new methods and runtime performance improvements. Be aware of that when
  53. upgrading.
  54. # 1.1.1 (2016-06-22)
  55. - add more context to errors if they are not instanceof Error
  56. # 1.1.0 (2015-09-29)
  57. - add Emitter#listerCount (to match node v4 api)
  58. # 1.0.2 (2014-08-28)
  59. - remove un-reachable code
  60. - update devDeps
  61. ## 1.0.1 / 2014-05-11
  62. - check for console.trace before using it
  63. ## 1.0.0 / 2013-12-10
  64. - Update to latest events code from node.js 0.10
  65. - copy tests from node.js
  66. ## 0.4.0 / 2011-07-03 ##
  67. - Switching to graphquire@0.8.0
  68. ## 0.3.0 / 2011-07-03 ##
  69. - Switching to URL based module require.
  70. ## 0.2.0 / 2011-06-10 ##
  71. - Simplified package structure.
  72. - Graphquire for dependency management.
  73. ## 0.1.1 / 2011-05-16 ##
  74. - Unhandled errors are logged via console.error
  75. ## 0.1.0 / 2011-04-22 ##
  76. - Initial release