Support emit method and custom events.