Defer possibly completed event/ajax emits

This allows for future defers of the same type to be executed on the same event loop and continue proper execution.

Fixes #39