Skip to content

Commit 6229ef3

Browse files
committed
avoid ReferenceError window is not defined when running in the node environment
1 parent a7027c0 commit 6229ef3

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)