Skip to content

Commit

Permalink
Merge pull request #25 from theqwertman/master
Browse files Browse the repository at this point in the history
Made script Browserify-compatible
  • Loading branch information
stephband committed Dec 13, 2015
2 parents 80071a7 + c677b07 commit b7e34b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ jQuery('.mydiv')

<p>To see an example of what could be done with it, <a href="http://stephband.info/jquery.event.move/">stephband.info/jquery.event.move/</a></p>

<h2>CommonJS</h2>

<p>If you're using Browserify, or any other CommonJS-compatible module system, you can require this script by passing it your jQuery reference. For example,<p>

<pre><code class="js">
require('./path/to/jquery.event.move.js')(jQuery);
</code></pre>

<h2>Tweet me</h2>

<p>If you use move events on something interesting, tweet me <a href="http://twitter.com/stephband">@stephband</a>!</p>
<p>If you use move events on something interesting, tweet me <a href="http://twitter.com/stephband">@stephband</a>!</p>
10 changes: 6 additions & 4 deletions js/jquery.event.move.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
// velocityY: Average velocity over last few events.


(function (module) {
(function (thisModule) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], module);
// AMD. Register as an anonymous module.
define(['jquery'], thisModule);
} else if ((typeof module !== "undefined" && module !== null) && module.exports) {
module.exports = thisModule;
} else {
// Browser globals
module(jQuery);
thisModule(jQuery);
}
})(function(jQuery, undefined){

Expand Down

0 comments on commit b7e34b0

Please sign in to comment.