Browse Source

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 years ago
parent
commit
f82c4f1f7f
1 changed files with 9 additions and 1 deletions
  1. 9 1
      index.html

+ 9 - 1
index.html

@@ -24,7 +24,15 @@
                 require.callback = function () {
                 require.callback = function () {
                     require(["helios/polyfills"], function () {
                     require(["helios/polyfills"], function () {
                         require(["helios/app", "amber/core/Platform-Browser"], function (amber) {
                         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();
                                 amber.globals.HLManager._setup();
                             });
                             });
                         });
                         });