Skip to content

Instantly share code, notes, and snippets.

@alexander-williamson
Last active May 28, 2017 19:06
Show Gist options
  • Save alexander-williamson/3d5fb40a9dc6a578b4e004f1d0cb0f48 to your computer and use it in GitHub Desktop.
Save alexander-williamson/3d5fb40a9dc6a578b4e004f1d0cb0f48 to your computer and use it in GitHub Desktop.
RequireJs jQuery
// tinypubsub:
// https://gist.github.com/cowboy/661855
// code assumes you have shimmed jquery with the correct version in requirejs config:
// http://requirejs.org/docs/jquery.html#modulename
define(["jquery"], function (jQuery) {
var o = jQuery({});
jQuery.subscribe = function () {
o.on.apply(o, arguments);
};
jQuery.unsubscribe = function () {
o.off.apply(o, arguments);
};
jQuery.publish = function () {
o.trigger.apply(o, arguments);
};
return jQuery;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment