Lines Matching refs:promise
165 * Promise is a great tool for writing asynchronous code. However, the construct
166 * var p = new promise(function init(resolve, reject) {
167 * ... // code that fulfills the Promise.
169 * forces the Promise-resolving logic to reside in the |init| function
171 * Promise in a member function(which is quite common for event callbacks).
173 * base.Deferred comes to the rescue. It encapsulates a Promise
177 * function that returns a Promise:
182 * 4. Return deferred.promise() to the caller so that it can subscribe
191 * return deferred.promise();
210 * @type {Promise}
213 this.promise_ = new Promise(
236 /** @return {Promise} */
237 base.Deferred.prototype.promise = function() {
241 base.Promise = function() {};
245 * @return {Promise} a Promise that will be fulfilled after |delay| ms.
247 base.Promise.sleep = function(delay) {
248 return new Promise(
257 * @param {Promise} promise
258 * @return {Promise} a Promise that will be fulfilled iff the specified Promise
261 base.Promise.negate = function(promise) {
262 return promise.then(
263 /** @return {Promise} */
265 return Promise.reject();
267 /** @return {Promise} */
269 return Promise.resolve();