Back to problems

Implement a Publish-Subscribe Event Bus in JavaScript or TypeScript

Object-Oriented Programming · Tradedesk · Medium

Implement an in-process publish/subscribe (pub/sub) event hub for use inside one front-end JavaScript or TypeScript application. The hub must allow callers to register a listener for a named topic, send a value to every listener currently attached to that topic, and detach a listener when it is no longer needed. Provide the implementation, justify the API decisions, and outline a testing approach. The API surface is yours to choose, but it must include at least three…

Checking your access…