Skip to content

Instantly share code, notes, and snippets.

@ijy
Created June 28, 2013 14:19
Show Gist options
  • Save ijy/5885022 to your computer and use it in GitHub Desktop.
Save ijy/5885022 to your computer and use it in GitHub Desktop.
jQuery PubSub in three lines. This will work in IE9+, so it's a perfect choice for jQuery 2.0 projects.
var o = $({});
$.subscribe = o.on.bind(o);
$.publish = o.trigger.bind(o);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment