resolver.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. goog.provide('goog.promise.Resolver');
  15. /**
  16. * Resolver interface for promises. The resolver is a convenience interface that
  17. * bundles the promise and its associated resolve and reject functions together,
  18. * for cases where the resolver needs to be persisted internally.
  19. *
  20. * @interface
  21. * @template TYPE
  22. */
  23. goog.promise.Resolver = function() {};
  24. /**
  25. * The promise that created this resolver.
  26. * @type {!goog.Promise<TYPE>}
  27. */
  28. goog.promise.Resolver.prototype.promise;
  29. /**
  30. * Resolves this resolver with the specified value.
  31. * @type {function((TYPE|goog.Promise<TYPE>|Thenable)=)}
  32. */
  33. goog.promise.Resolver.prototype.resolve;
  34. /**
  35. * Rejects this resolver with the specified reason.
  36. * @type {function(*=): void}
  37. */
  38. goog.promise.Resolver.prototype.reject;