diff --git a/templates/html5/output.js b/templates/html5/output.js
index 46889eae2..da522b6ca 100644
--- a/templates/html5/output.js
+++ b/templates/html5/output.js
@@ -1,7 +1,9 @@
-(function ($hx_exports, $global) {
+var $lime_init = (function ($hx_exports, $global) {
"use strict";
- var $hx_script = (function (exports, global) { ::SOURCE_FILE:: });
+ var $hx_script = (function (exports, global) {
+::SOURCE_FILE::
+ });
if (typeof self !== "undefined" && self.constructor.name.includes("Worker")) {
// No need for exports in a worker context, just initialize statics.
@@ -10,33 +12,27 @@
$hx_exports.lime = $hx_exports.lime || {};
$hx_exports.lime.$scripts = $hx_exports.lime.$scripts || {};
$hx_exports.lime.$scripts["::APP_FILE::"] = $hx_script;
-
$hx_exports.lime.embed = function (projectName) {
var exports = {};
-
var script = $hx_exports.lime.$scripts[projectName];
if (!script) throw Error("Cannot find project name \"" + projectName + "\"");
script(exports, $global);
-
for (var key in exports) $hx_exports[key] = $hx_exports[key] || exports[key];
-
var lime = exports.lime || window.lime;
if (lime && lime.embed && this !== lime.embed) lime.embed.apply(lime, arguments);
-
return exports;
};
}
- // AMD compatibility: If define() is present we need to
- // - call it, to define our module
- // - disable it so that the embedded libraries register themselves in the global scope!
if (typeof define === "function" && define.amd) {
define([], function () { return $hx_exports.lime; });
define.__amd = define.amd;
define.amd = null;
}
-})(typeof exports !== "undefined" ? exports : typeof define === "function" && define.amd ? {} : typeof globalThis !== "undefined" ? globalThis : self,
- typeof globalThis !== "undefined" ? globalThis : self);
+})
+
+$lime_init(typeof exports !== "undefined" ? exports : typeof define === "function" && define.amd ? {} : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : this,
+typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : this);
::if embeddedLibraries::::foreach embeddedLibraries::
::__current__::::end::::end::