Browse Source

amber/_st redirected to underscore-less file

This should dispel them problems with amber on gh-pages of projects.
Herbert Vojčík 10 years ago
parent
commit
2a971ec6b1
3 changed files with 21 additions and 0 deletions
  1. 2 0
      support/_st.js
  2. 1 0
      support/amber.js
  3. 18 0
      support/as-receiver.js

+ 2 - 0
support/_st.js

@@ -1,3 +1,5 @@
+// !!! THIS FILE IS DEPRECATED !!!
+// Use as-receiver.js instead.
 
 /**
  * _st is a function used all over the compiled amber code that

+ 1 - 0
support/amber.js

@@ -78,6 +78,7 @@ require = function (require) {
         paths: {
             'amber': amber_home + '/support',
             'amber_vm': amber_home + '/support',
+            'amber_vm/_st': amber_home + '/support/as-receiver',
             'amber_css': amber_home + '/css',
             'amber_lib': library_home,
             'amber_core': amber_home + '/src',

+ 18 - 0
support/as-receiver.js

@@ -0,0 +1,18 @@
+
+/**
+ * _st is a function used all over the compiled amber code that
+ * takes any value (JavaScript or Smalltalk)
+ * and returns a proper Amber Smalltalk receiver.
+ *
+ * null or undefined -> nil,
+ * plain JS object -> wrapped JS object,
+ * otherwise unchanged
+ */
+
+define("amber_vm/_st", ["./globals", "./nil"], function (globals, nil) {
+    return function (o) {
+        if (o == null) { return nil; }
+        if (o.klass) { return o; }
+        return globals.JSObjectProxy._on_(o);
+    };
+});