Skip to content

Instantly share code, notes, and snippets.

@hontas
Created October 23, 2012 09:33
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 hontas/3937887 to your computer and use it in GitHub Desktop.
Save hontas/3937887 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