Last active
May 28, 2017 19:06
-
-
Save alexander-williamson/3d5fb40a9dc6a578b4e004f1d0cb0f48 to your computer and use it in GitHub Desktop.
RequireJs jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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