瀏覽代碼

Try to solve Helios vs. main page settings.

Helios and app page, being on the same domain,
share same local storage.
If they all had their own settings object
and both saved on page unload, quirks arose.
The solution is to share the same settings object in such case.
Herby Vojčík 4 年之前
父節點
當前提交
f82c4f1f7f
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      index.html

+ 9 - 1
index.html

@@ -24,7 +24,15 @@
                 require.callback = function () {
                     require(["helios/polyfills"], function () {
                         require(["helios/app", "amber/core/Platform-Browser"], function (amber) {
-                            amber.initialize({'transport.defaultAmdNamespace': "helios"}).then(function () {
+                            var options;
+                            if (window.opener) {
+                                // Slave: use master's settings
+                                amber.globals.SmalltalkSettings = window.opener.require('amber/helpers').globals.SmalltalkSettings;
+                            } else {
+                                // Standalone: set default amd namespace
+                                options = {'transport.defaultAmdNamespace': "helios"};
+                            }
+                            amber.initialize(options).then(function () {
                                 amber.globals.HLManager._setup();
                             });
                         });