How to use the on function from events
Find comprehensive JavaScript events.on code examples handpicked from public code repositorys.
172 173 174 175 176 177 178 179 180 181const emitter = new NodeEventTarget(); const interval = setInterval(() => { emitter.dispatchEvent(new Event('foo')); }, 0); let count = 0; for await (const [ item ] of on(emitter, 'foo')) { count++; strictEqual(item.type, 'foo'); if (count > 5) { break;
events.prototype is the most popular function in events (93 examples)