Skip to content

Instantly share code, notes, and snippets.

@jCrip
Forked from cowboy/HEY-YOU.md
Created October 31, 2012 16:45
Show Gist options
  • Save jCrip/3988191 to your computer and use it in GitHub Desktop.
Save jCrip/3988191 to your computer and use it in GitHub Desktop.
jQuery: Tiny Pub/Sub
/* jQuery Tiny Pub/Sub */
(function($) {
var o = $({});
$.subscribe = function() {o.on.apply(o, arguments);};
$.unsubscribe = function() {o.off.apply(o, arguments);};
$.publish = function() {o.trigger.apply(o, arguments);};
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment