Skip to content

Instantly share code, notes, and snippets.

@JonathanBeech
Created August 7, 2012 20:05
Show Gist options
  • Save JonathanBeech/3288881 to your computer and use it in GitHub Desktop.
Save JonathanBeech/3288881 to your computer and use it in GitHub Desktop.
Javascript: JQueryPubSub
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(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