piskel/js/lib/pubsub.js

26 lines
476 B
JavaScript
Raw Normal View History

2012-08-30 02:48:22 +04:00
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
//console.log("SUBSCRIBE: " + arguments[0]);
2012-08-30 02:48:22 +04:00
o.on.apply(o, arguments);
};
$.unsubscribe = function() {
o.off.apply(o, arguments);
};
$.publish = function() {
//console.log("PUBLISH: " + arguments[0]);
2012-08-30 02:48:22 +04:00
o.trigger.apply(o, arguments);
};
}(jQuery));