Browse Source

amber/helpers: loadPackages.

Herby Vojčík 5 years ago
parent
commit
d0cd98f4c9
3 changed files with 13 additions and 11 deletions
  1. 2 11
      index.html
  2. 3 0
      lang/API-CHANGES.txt
  3. 8 0
      lang/base/helpers.js

+ 2 - 11
index.html

@@ -50,25 +50,16 @@
                 amber.initialize({'transport.defaultAmdNamespace': "amber_core"})
                     .then(function () {
                         messageBox.appendChild(loadingIdeSupport);
-                        return amberLoad(["amber/lang", "amber/legacy/IDE", "amber_core/SUnit"]);
+                        return amber.loadPackages(["amber/lang", "amber/legacy/IDE", "amber_core/SUnit"]);
                     })
                     .then(function () {
                         startLegacy.disabled = startHelios.disabled = false;
                         messageBox.appendChild(loadingTheRest);
-                        return amberLoad(["amber/devel", "amber/legacy/Benchfib", "helios/all", "amber_cli/AmberCli"]);
+                        return amber.loadPackages(["amber/devel", "amber/legacy/Benchfib", "helios/all", "amber_cli/AmberCli"]);
                     })
                     .then(function () {
                         messageBox.appendChild(done);
                     });
-
-                function amberLoad (modules) {
-                    return new Promise(function (resolve, reject) {
-                        require(modules, resolve, reject);
-                    }).then(function () {
-                        return amber.globals.Smalltalk._postLoad();
-                    });
-                }
-
             });
         });
     })();

+ 3 - 0
lang/API-CHANGES.txt

@@ -5,6 +5,9 @@
 * Deprecate CharacterArray class
 * Deprecate Collection >> copyWithAll:, #, is enough.
 
++ amber/helpers exports
+  + loadPackages
+
 - Array >>
   - numericallyIndexable
 - Set

+ 8 - 0
lang/base/helpers.js

@@ -62,6 +62,14 @@ define(["amber/boot", "require"], function (boot, require) {
         });
     };
 
+    exports.loadPackages = function (modules) {
+        return new Promise(function (resolve, reject) {
+            require(modules, resolve, reject);
+        }).then(function () {
+            return globals.Smalltalk._postLoad();
+        });
+    };
+
     // Exports
 
     return exports;