Parcourir la source

Merge pull request #1011 from herby/helios-popupping-itself

Helios is popupping itself, client only checks for its presence.
Nicolas Petton il y a 10 ans
Parent
commit
c75a62dfc4
2 fichiers modifiés avec 15 ajouts et 1 suppressions
  1. 10 0
      support/helios/index.js
  2. 5 1
      support/helpers.js

+ 10 - 0
support/helios/index.js

@@ -0,0 +1,10 @@
+define(["require"], function (require) {
+    return  {
+        popup: function () {
+            window.open(require.toUrl('./index.html'), "Helios", "menubar=no, width=1000, height=600");
+        },
+        go: function () {
+            window.location.href = require.toUrl('./index.html');
+        }
+    };
+});

+ 5 - 1
support/helpers.js

@@ -7,7 +7,11 @@ define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
     // API
 
     exports.popupHelios = function () {
-        window.open(require.toUrl('helios/index.html'), "Helios", "menubar=no, width=1000, height=600");
+        require(['helios/index'], function (helios) {
+            helios.popup();
+        }, function (err) {
+            window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
+        });
     };
     Object.defineProperty(exports, "vm", {
         value: vm,