| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -282,7 +282,7 @@ function onceWrapper(...args) { | |||
| 282 | 282 | if (!this.fired) { | |
| 283 | 283 | this.target.removeListener(this.type, this.wrapFn); | |
| 284 | 284 | this.fired = true; | |
| 285 | - Reflect.apply(this.listener, this.target, args); | ||
| 285 | + return Reflect.apply(this.listener, this.target, args); | ||
| 286 | 286 | } | |
| 287 | 287 | } | |
| 288 | 288 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,12 @@ const events = require('events'); | |||
| 27 | 27 | ||
| 28 | 28 | function listener() {} | |
| 29 | 29 | function listener2() {} | |
| 30 | + function listener3() { | ||
| 31 | + return 0; | ||
| 32 | + } | ||
| 33 | + function listener4() { | ||
| 34 | + return 1; | ||
| 35 | + } | ||
| 30 | 36 | ||
| 31 | 37 | { | |
| 32 | 38 | const ee = new events.EventEmitter(); | |
@@ -101,3 +107,15 @@ function listener2() {} | |||
| 101 | 107 | assert.strictEqual(wrappedListeners.length, 2); | |
| 102 | 108 | assert.strictEqual(wrappedListeners[1].listener, listener); | |
| 103 | 109 | } | |
| 110 | + | ||
| 111 | + { | ||
| 112 | + const ee = new events.EventEmitter(); | ||
| 113 | + ee.once('foo', listener3); | ||
| 114 | + ee.on('foo', listener4); | ||
| 115 | + const rawListeners = ee.rawListeners('foo'); | ||
| 116 | + assert.strictEqual(rawListeners.length, 2); | ||
| 117 | + assert.strictEqual(rawListeners[0](), 0); | ||
| 118 | + const rawListener = ee.rawListeners('foo'); | ||
| 119 | + assert.strictEqual(rawListener.length, 1); | ||
| 120 | + assert.strictEqual(rawListener[0](), 1); | ||
| 121 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments