A buffer of events that are of the same type.
//Creates a new event dispatcher with string as its event payload.const dispatch = new Events<string>()//adds an event to dispatcherdispatch.write("hello there")//gets all events in the event dispatchdispatch.each(event=>{ console.log(event.data)//outputs "hello world"})//Removes all buffered events.dispatch.clear() Copy
//Creates a new event dispatcher with string as its event payload.const dispatch = new Events<string>()//adds an event to dispatcherdispatch.write("hello there")//gets all events in the event dispatchdispatch.each(event=>{ console.log(event.data)//outputs "hello world"})//Removes all buffered events.dispatch.clear()
Clear the events.
Returns the first of the events captured if any event is captured.
A buffer of events that are of the same type.
Example