Skip to content

Commit

Permalink
fix: NW.js module is not defined fix.
Browse files Browse the repository at this point in the history
Now the factory assignment for localforage is applied to
`global.modules.exports` instead of `modules.exports` if `module` is
undefined.
`module` is undefined in an NW.js environment (for whatever
reason). So now we check for module and we uses global if `module`
is undefined. Otherwise we proceed as before.

Thank @ashleyhindle for fix.

Fixes #77
  • Loading branch information
bradtaniguchi committed Jan 3, 2017
1 parent ee0de4a commit e95da45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dist/angular-localForage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
return factory(angular, localforage);
});
} else if(typeof exports === 'object' || typeof global === 'object') {
module.exports = factory(angular, require('localforage')); // Node/Browserify
if(typeof module === 'undefined') {
global.module.exports = factory(angular, require('localforage')); // NW.js
} else {
modules.exports = factory(angular, require('localforage')); // Node/Browserify
}
} else {
return factory(angular, root.localforage); // Browser
}
Expand Down

0 comments on commit e95da45

Please sign in to comment.