event-driven publish-subscribe javascript api