Skip to content

Commit 348527d

Browse files
authored
Merge pull request #257 from MartinNuc/universal-support
Avoid ReferenceError window is not defined in the node environment
2 parents a7027c0 + 6229ef3 commit 348527d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/flow.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
* @license MIT
33
*/
44
(function(window, document, undefined) {'use strict';
5+
if (!window || !document) {
6+
console.warn('Flowjs needs window and document objects to work');
7+
return;
8+
}
59
// ie10+
610
var ie10plus = window.navigator.msPointerEnabled;
711
/**
@@ -1632,4 +1636,4 @@
16321636
define( "flow", [], function () { return Flow; } );
16331637
}
16341638
}
1635-
})(window, document);
1639+
})(typeof window !== 'undefined' && window, typeof document !== 'undefined' && document);

0 commit comments

Comments
 (0)