Browse Source

Fix error when using as AMD module

This module currently breaks when used as an AMD module (at least in RequireJS) as the first argument passed to `factory` from `define` is a reference to `require` not `window`, and so means that `addEventListener` is unavailable. If you switch this to pass a function to define which then returns factory with `root` passed correctly it works OK.
pull/53/head
David Rapson 10 years ago
parent
commit
a933362afa
  1. 4
      src/echo.js

4
src/echo.js

@ -1,6 +1,8 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
define(function() {
return factory(root)
});
} else if (typeof exports === 'object') {
module.exports = factory;
} else {

Loading…
Cancel
Save