Skip to content

Commit

Permalink
update url polyfill to use umd
Browse files Browse the repository at this point in the history
  • Loading branch information
fchasen committed Nov 16, 2016
1 parent ad26711 commit dd14b69
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions libs/url/url.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */

(function(scope) {
'use strict';
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory(global);
} else {
// Browser globals (root is window)
root.URL = factory(root);
}
}(this, function (scope) {

// feature detect for URL constructor
var hasWorkingUrl = false;
Expand All @@ -15,7 +25,7 @@
}

if (hasWorkingUrl)
return;
return scope.URL;

var relative = Object.create(null);
relative['ftp'] = 21;
Expand Down Expand Up @@ -611,11 +621,5 @@
};
}

scope.URL = jURL;

// Export for CommonJS
if (typeof module === 'object' && module.exports) {
module.exports = jURL;
}

})(this);
return jURL;
}));

0 comments on commit dd14b69

Please sign in to comment.