Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Forked from cowboy/HEY-YOU.md
Last active May 26, 2016 22:13
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 steveosoule/6f350ffa324f4cd7fdc0705a88309fb4 to your computer and use it in GitHub Desktop.
Save steveosoule/6f350ffa324f4cd7fdc0705a88309fb4 to your computer and use it in GitHub Desktop.
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* https://github.com/cowboy/jquery-tiny-pubsub
* 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