Home | History | Annotate | Download | only in src

Lines Matching full:promise

37 var $Promise = Promise;
53 var promiseStatus = NEW_PRIVATE("Promise#status");
54 var promiseValue = NEW_PRIVATE("Promise#value");
55 var promiseOnResolve = NEW_PRIVATE("Promise#onResolve");
56 var promiseOnReject = NEW_PRIVATE("Promise#onReject");
57 var promiseRaw = NEW_PRIVATE("Promise#raw");
63 function Promise(resolver) {
65 var promise = PromiseInit(this);
66 resolver(function(x) { PromiseResolve(promise, x) },
67 function(r) { PromiseReject(promise, r) });
72 function PromiseSet(promise, status, value, onResolve, onReject) {
73 SET_PRIVATE(promise, promiseStatus, status);
74 SET_PRIVATE(promise, promiseValue, value);
75 SET_PRIVATE(promise, promiseOnResolve, onResolve);
76 SET_PRIVATE(promise, promiseOnReject, onReject);
77 return promise;
80 function PromiseInit(promise) {
81 return PromiseSet(promise, 0, UNDEFINED, new InternalArray, new InternalArray)
84 function PromiseDone(promise, status, value, promiseQueue) {
85 if (GET_PRIVATE(promise, promiseStatus) !== 0) return;
86 PromiseEnqueue(value, GET_PRIVATE(promise, promiseQueue));
87 PromiseSet(promise, status, value);
90 function PromiseResolve(promise, x) {
91 PromiseDone(promise, +1, x, promiseOnResolve)
94 function PromiseReject(promise, r) {
95 PromiseDone(promise, -1, r, promiseOnReject)
102 if (this === $Promise) {
104 var promise = PromiseInit(new Promise(promiseRaw));
106 promise: promise,
107 resolve: function(x) { PromiseResolve(promise, x) },
108 reject: function(r) { PromiseReject(promise, r) }
112 result.promise = new this(function(resolve, reject) {
121 if (this === $Promise) {
123 return PromiseSet(new Promise(promiseRaw), +1, x);
130 if (this === $Promise) {
132 return PromiseSet(new Promise(promiseRaw), -1, r);
162 return deferred.promise;
186 if (result === deferred.promise)
230 PromiseCoerce.table.set(x, deferred.promise);
236 return deferred.promise;
270 return deferred.promise;
282 return deferred.promise;
289 global.Promise = $Promise;
290 InstallFunctions($Promise, DONT_ENUM, [
298 InstallFunctions($Promise.prototype, DONT_ENUM, [