Skip to content

Instantly share code, notes, and snippets.

@akshaye
Last active December 11, 2015 17:19
Show Gist options
  • Select an option

  • Save akshaye/4633499 to your computer and use it in GitHub Desktop.

Select an option

Save akshaye/4633499 to your computer and use it in GitHub Desktop.

Distributed events - where a single incident can trigger reactions throughout your application.

PubSub

It works like an aggregator; publishing one event to anyone who wants to subscribe. For example, Node's EventEmitter, jQuery's bind-like functions etc.

" Though PubSub deals with async events, there's nothing inherently async about it. Understand: When user clicks a button, that's an async event, which gets pushed to event queue and is subsequently fired by the runtime. But everything that happens as a result of that event is synchronous. All the handlers attached to that event fire in sequence, one after the other. This is important to understand because if too many handlers fire in resposne to an event, you risk blocking the thread and making the browser unresponsive. "

Evented Models

as in Backbone.js, where a model publishes notifications when any data changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment