Browse Source

Helpers return vm and globals, are fake smalltalk for legacy loaders

Herbert Vojčík 11 years ago
parent
commit
4f8cee7633
1 changed files with 30 additions and 6 deletions
  1. 30 6
      support/helpers.js

+ 30 - 6
support/helpers.js

@@ -1,12 +1,36 @@
-define("amber/helpers", ["amber_vm/smalltalk", "require"], function (smalltalk, require) {
-    var exports = {
-        popupHelios: function () {
-            window.open(require.toUrl('amber_helios/html/helios.html'), "Helios", "menubar=no, status=no, scrollbars=no, menubar=no, width=1000, height=600");
-        }
+define("amber/helpers", ["amber_vm/smalltalk", "amber_vm/globals", "require"], function (vm, globals, require) {
+    var exports = Object.create(globals);
+
+    // API
+
+    exports.popupHelios = function () {
+        window.open(require.toUrl('amber_helios/html/helios.html'), "Helios", "menubar=no, status=no, scrollbars=no, menubar=no, width=1000, height=600");
     };
+    Object.defineProperty(exports, "vm", {
+        value: vm,
+        enumerable: true, configurable: true, writable: false
+    });
+    Object.defineProperty(exports, "globals", {
+        value: globals,
+        enumerable: true, configurable: true, writable: false
+    });
+
+    // Backward compatibility, deprecated
+
     Object.defineProperty(exports, "smalltalk", {
-        value: smalltalk,
+        value: vm,
         enumerable: true, configurable: true, writable: false
     });
+    exports.defaultAmdNamespace = null;
+    exports.initialize = function () {
+        console.warn("smalltalk.defaultAmdNamespace is deprecated. Please use smalltalk.vm.defaultAmdNamespace instead.");
+        console.warn("smalltalk.initialize is deprecated. Please  use smalltalk.vm.initialize instead.");
+        console.warn("smalltalk.ClassName is deprecated. Please  use smalltalk.globals.ClassName instead.");
+        vm.defaultAmdNamespace = exports.defaultAmdNamespace || vm.defaultAmdNamespace;
+        return vm.initialize();
+    };
+
+    // Exports
+
     return  exports;
 });