Emit and listen to events from non-dom objects