Skip to content

Instantly share code, notes, and snippets.

@clemdev
Created March 8, 2012 15:51
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 clemdev/2001617 to your computer and use it in GitHub Desktop.
Save clemdev/2001617 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