Skip to content

Commit b196806

Browse files
authoredAug 1, 2023
fix: support more environments (#5266)
1 parent 101e6e8 commit b196806

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed
 

‎Makefile.dryice.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -781,21 +781,27 @@ function namespace(ns) {
781781
function exportAce(ns, modules, requireBase, extModules) {
782782
requireBase = requireBase || "window";
783783
return function(text) {
784-
/*globals REQUIRE_NS, MODULES*/
784+
/*globals REQUIRE_NS, MODULES, self*/
785785
var template = function() {
786786
(function() {
787787
REQUIRE_NS.require(MODULES, function(a) {
788788
if (a) {
789789
a.config.init(true);
790790
a.define = REQUIRE_NS.define;
791791
}
792-
if (!window.NS)
793-
window.NS = a;
792+
var global = (function () {
793+
return this;
794+
})();
795+
if (!global && typeof window != "undefined") global = window; // can happen in strict mode
796+
if (!global && typeof self != "undefined") global = self; // can happen in webworker
797+
798+
if (!global.NS)
799+
global.NS = a;
794800
for (var key in a) if (a.hasOwnProperty(key))
795-
window.NS[key] = a[key];
796-
window.NS["default"] = window.NS;
801+
global.NS[key] = a[key];
802+
global.NS["default"] = global.NS;
797803
if (typeof module == "object" && typeof exports == "object" && module) {
798-
module.exports = window.NS;
804+
module.exports = global.NS;
799805
}
800806
});
801807
})();

0 commit comments

Comments
 (0)
Please sign in to comment.