| 1 |
// Copyright 2013 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
goog.provide('goog.promise.Resolver'); |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
/** |
| 20 |
* Resolver interface for promises. The resolver is a convenience interface that |
| 21 |
* bundles the promise and its associated resolve and reject functions together, |
| 22 |
* for cases where the resolver needs to be persisted internally. |
| 23 |
* |
| 24 |
* @interface |
| 25 |
* @template TYPE |
| 26 |
*/ |
| 27 |
goog.promise.Resolver = function() {}; |
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* The promise that created this resolver. |
| 32 |
* @type {!goog.Promise<TYPE>} |
| 33 |
*/ |
| 34 |
goog.promise.Resolver.prototype.promise; |
| 35 |
|
| 36 |
|
| 37 |
/** |
| 38 |
* Resolves this resolver with the specified value. |
| 39 |
* @type {function((TYPE|goog.Promise<TYPE>|Thenable)=)} |
| 40 |
*/ |
| 41 |
goog.promise.Resolver.prototype.resolve; |
| 42 |
|
| 43 |
|
| 44 |
/** |
| 45 |
* Rejects this resolver with the specified reason. |
| 46 |
* @type {function(*=): void} |
| 47 |
*/ |
| 48 |
goog.promise.Resolver.prototype.reject; |