Skip to content

Instantly share code, notes, and snippets.

@aercolino
Forked from cowboy/HEY-YOU.md
Last active Aug 29, 2015
Embed
What would you like to do?
jQuery.news = (function($) {
var broker = $({});
return {
subscribe: function() {
$.fn.on.apply(broker, arguments);
},
unsubscribe: function() {
$.fn.off.apply(broker, arguments);
},
publish: function() {
$.fn.trigger.apply(broker, arguments);
}
};
}(jQuery));
@aercolino
Copy link
Author

aercolino commented Jun 8, 2014

Use it like $.news.publish, $.news.subscribe, $.news.unsubscribe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment