瀏覽代碼

Wrap the JS Promise.

Herbert Vojčík 8 年之前
父節點
當前提交
d0d2ea16df
共有 3 個文件被更改,包括 11 次插入0 次删除
  1. 3 0
      src/Kernel-Promises.js
  2. 4 0
      src/Kernel-Promises.st
  3. 4 0
      support/boot.js

+ 3 - 0
src/Kernel-Promises.js

@@ -141,6 +141,9 @@ messageSends: []
 $globals.Thenable);
 
 
+
+$core.addClass('Promise', $globals.Thenable, [], 'Kernel-Promises');
+
 $core.addMethod(
 $core.method({
 selector: "all:",

+ 4 - 0
src/Kernel-Promises.st

@@ -43,6 +43,10 @@ then: aBlock
 })>
 ! !
 
+Thenable subclass: #Promise
+	instanceVariableNames: ''
+	package: 'Kernel-Promises'!
+
 !JSObjectProxy methodsFor: '*Kernel-Promises'!
 
 all: nadicBlock

+ 4 - 0
support/boot.js

@@ -772,6 +772,10 @@ define(['require', './compatibility'], function (require) {
             st.addPackage("Kernel-Exceptions");
             st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
 
+            st.addPackage("Kernel-Promises");
+            st.addClass("Thenable", globals.Object, null, "Kernel-Promises");
+            st.wrapClassName("Promise", "Kernel-Promises", Promise, globals.Thenable);
+
             /* Alias definitions */
 
             st.alias(globals.Array, "OrderedCollection");