Skip to content

Commit

Permalink
Allow to work in non-browser env
Browse files Browse the repository at this point in the history
‘window’ is specific to browser environments.  The convnetjs variable
has already been made into a global variable at this point, so the
assignment is redundant.  This allows it to work in non-browser
environments other than node.
  • Loading branch information
cpansprout authored and sprout committed Jun 26, 2017
1 parent 4c3358a commit f226f13
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/convnet_export.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(function(lib) {
"use strict";
if (typeof module === "undefined" || typeof module.exports === "undefined") {
window.convnetjs = lib; // in ordinary browser attach library to window
// By declaring convnetjs globally, we have already made it available.
// Nothing to do here.
} else {
module.exports = lib; // in nodejs
}
Expand Down

0 comments on commit f226f13

Please sign in to comment.