Skip to content

Instantly share code, notes, and snippets.

@Raysharr
Forked from maxvipon/jquery-pubsub.js
Created October 18, 2012 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raysharr/3914595 to your computer and use it in GitHub Desktop.
Save Raysharr/3914595 to your computer and use it in GitHub Desktop.
JavaScript: PubSub [jquery]
/* @paul_irish Pub/Sub
* Works in modern browsers + IE9
* Use Modernizr ployfill for function.bind */
(function($) {
var o = $({});
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment