Unified interface for event distribution and consumption in web apps