Skip to content

Commit 4d7630c

Browse files
committed
feat: AMD/requirejs support
1 parent ed14b49 commit 4d7630c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/flow.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,12 +1399,15 @@
13991399
* @type {FlowChunk}
14001400
*/
14011401
Flow.FlowChunk = FlowChunk;
1402-
1403-
window.Flow = Flow;
1404-
1405-
})(window, document);
1406-
1407-
// Node.js-style export for Node and Component
1408-
if (typeof module !== 'undefined') {
1409-
module.exports = window.Flow;
1410-
}
1402+
1403+
if (typeof module !== 'undefined') {
1404+
module.exports = Flow;
1405+
} else if (typeof define === "function" && define.amd) {
1406+
// AMD/requirejs: Define the module
1407+
define(function(){
1408+
return Flow;
1409+
});
1410+
} else {
1411+
window.Flow = Flow;
1412+
}
1413+
})(window, document);

0 commit comments

Comments
 (0)