Skip to content

Commit 2274b3d

Browse files
committed
fix: module exports
1 parent bdfb649 commit 2274b3d

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flow.js",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"main": "src/flow.js",
55
"ignore": [
66
"**/.*",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flow.js",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Flow.js library implements html5 file upload and provides multiple simultaneous, stable, fault tolerant and resumable uploads.",
55
"main": "src/flow.js",
66
"scripts": {

src/flow.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,16 +1428,27 @@
14281428
* Library version
14291429
* @type {string}
14301430
*/
1431-
Flow.version = '2.0.0';
1431+
Flow.version = '2.0.1';
14321432

1433-
if (typeof module !== 'undefined') {
1433+
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
1434+
// Expose Flow as module.exports in loaders that implement the Node
1435+
// module pattern (including browserify). Do not create the global, since
1436+
// the user will be storing it themselves locally, and globals are frowned
1437+
// upon in the Node module world.
14341438
module.exports = Flow;
1435-
} else if (typeof define === "function" && define.amd) {
1436-
// AMD/requirejs: Define the module
1437-
define(function(){
1438-
return Flow;
1439-
});
14401439
} else {
1440+
// Otherwise expose Flow to the global object as usual
14411441
window.Flow = Flow;
1442+
1443+
// Register as a named AMD module, since jQuery can be concatenated with other
1444+
// files that may use define, but not via a proper concatenation script that
1445+
// understands anonymous AMD modules. A named AMD is safest and most robust
1446+
// way to register. Lowercase flow is used because AMD module names are
1447+
// derived from file names, and Flow is normally delivered in a lowercase
1448+
// file name. Do this after creating the global so that if an AMD module wants
1449+
// to call noConflict to hide this version of Flow, it will work.
1450+
if ( typeof define === "function" && define.amd ) {
1451+
define( "flow", [], function () { return Flow; } );
1452+
}
14421453
}
14431454
})(window, document);

0 commit comments

Comments
 (0)