Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
/*!
* jQuery Tiny Pub/Sub - v0.2pre - 11/3/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function ($) {
var bind = $.fn.bind, unbind = $.fn.unbind, trigger = $.fn.trigger, win = {
"0": window,
"length": 1
};
$.subscribe = function () {
bind.apply(win, arguments);
};
$.unsubscribe = function () {
unbind.apply(win, arguments);
};
$.publish = function () {
trigger.apply(win, arguments);
};
}(jQuery));
@cowboy

Not tiny enough! :P

@cowboy

BTW I just made it slightly smaller/better: https://gist.github.com/661855

@kitcambridge
Owner

I know, I had far too much fun with this. If anything, I suppose it could be considered a testament to jQuery's powerful use of duck-typing. :)

I like your updated version better, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.