| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3f33b5a commit 1a362d8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -839,8 +839,7 @@ added: | |||
| 839 | 839 | * `emitter` {EventEmitter} | |
| 840 | 840 | * `name` {string} | |
| 841 | 841 | * `options` {Object} | |
| 842 | - * `signal` {AbortSignal} An {AbortSignal} that may be used to cancel waiting | ||
| 843 | - for the event. | ||
| 842 | + * `signal` {AbortSignal} Can be used to cancel waiting for the event. | ||
| 844 | 843 | * Returns: {Promise} | |
| 845 | 844 | ||
| 846 | 845 | Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given | |
@@ -899,7 +898,7 @@ ee.emit('error', new Error('boom')); | |||
| 899 | 898 | // Prints: ok boom | |
| 900 | 899 | ``` | |
| 901 | 900 | ||
| 902 | - An {AbortSignal} may be used to cancel waiting for the event early: | ||
| 901 | + An {AbortSignal} can be used to cancel waiting for the event: | ||
| 903 | 902 | ||
| 904 | 903 | ```js | |
| 905 | 904 | const { EventEmitter, once } = require('events'); | |
@@ -922,6 +921,7 @@ async function foo(emitter, event, signal) { | |||
| 922 | 921 | ||
| 923 | 922 | foo(ee, 'foo', ac.signal); | |
| 924 | 923 | ac.abort(); // Abort waiting for the event | |
| 924 | + ee.emit('foo'); // Prints: Waiting for the event was canceled! | ||
| 925 | 925 | ``` | |
| 926 | 926 | ||
| 927 | 927 | ### Awaiting multiple events emitted on `process.nextTick()` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments