nodejs/test/parallel/test-eventtarget-once-twice.js

15 lines
318 B
JavaScript
Raw Permalink Normal View History

'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'));
});