Skip to content

Instantly share code, notes, and snippets.

@WideSolution
Created March 15, 2012 08:35
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 WideSolution/2042954 to your computer and use it in GitHub Desktop.
Save WideSolution/2042954 to your computer and use it in GitHub Desktop.
JavaScript: jQuery Pubsub
(function($) {
var o = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe'
}, function( key, api ) {
$[api] = function() {
o[key].apply( o, arguments );
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment