Skip to content

Instantly share code, notes, and snippets.

@maxvipon
Forked from TexRx/gist:2010435
Last active October 11, 2015 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxvipon/3851431 to your computer and use it in GitHub Desktop.
Save maxvipon/3851431 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