-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
events: fix add-remove-add case in EventTarget
Make sure that listeners are added properly if there has previously been one but currently are none for a given event type. PR-URL: #34056 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
1 parent
95cbfce
commit 0c32920
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Flags: --expose-internals --no-warnings | ||
'use strict'; | ||
const common = require('../common'); | ||
const { | ||
Event, | ||
EventTarget, | ||
} = require('internal/event_target'); | ||
const { once } = require('events'); | ||
|
||
const et = new EventTarget(); | ||
(async function() { | ||
await once(et, 'foo'); | ||
await once(et, 'foo'); | ||
})().then(common.mustCall()); | ||
|
||
et.dispatchEvent(new Event('foo')); | ||
setImmediate(() => { | ||
et.dispatchEvent(new Event('foo')); | ||
}); |