Procházet zdrojové kódy

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 před 4 roky
rodič
revize
f82c4f1f7f
1 změnil soubory, kde provedl 9 přidání a 1 odebrání
  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();
                             });
                         });