work-in-progress: make event api more js-friendly