Skip to content

dandre3000/async-next-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dandre3000/async-next-event

Use events asynchronously.

Install

npm i @dandre3000/async-next-event

Usage

import { asyncNextEvent, patchEventStopImmediatePropagation } from '@dandre3000/async-next-event'

const target = new EventTarget

Event.prototype.stopImmediatePropagation = patchEventStopImmediatePropagation()

target.addEventListener('test', event => event.stopImmediatePropagation())

setTimeout(() => target.dispatchEvent(new Event('test')), 1000)

console.log(await asyncNextEvent(target, 'test')) // Event

Exports

asyncNextEvent: (target: EventEmitter | EventTarget, type: any, signal?: AbortSignal) => Promise<any[]> | Promise<Event>

patchEventStopImmediatePropagation: () => (this: Event) => void

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors