Emits specified event. It should only be called by event loops.
type of event data
event data to emit