node/test/parallel/test-eventtarget-once-twice.js
Antoine du Hamel 36fbbe0b86 test: use global.EventTarget instead of internals
`EventTarget` is exposed on the global scope, there is no need to use
`--expose-internals` flag in the tests.

Refs: https://github.com/nodejs/node/pull/35496

PR-URL: https://github.com/nodejs/node/pull/36002
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-11-09 19:25:15 +01:00

15 lines
318 B
JavaScript

'use strict';
const common = require('../common');
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'));
});