diff --git a/closure/goog/promise/resolver.js b/closure/goog/promise/resolver.js index febf793fd4..939027532d 100644 --- a/closure/goog/promise/resolver.js +++ b/closure/goog/promise/resolver.js @@ -3,40 +3,37 @@ * Copyright The Closure Library Authors. * SPDX-License-Identifier: Apache-2.0 */ +goog.module('goog.promise.Resolver'); +goog.module.declareLegacyNamespace(); -goog.provide('goog.promise.Resolver'); - -goog.requireType('goog.Promise'); - - +const GoogPromise = goog.requireType('goog.Promise'); +const Thenable = goog.requireType('goog.Thenable'); /** * Resolver interface for promises. The resolver is a convenience interface that * bundles the promise and its associated resolve and reject functions together, * for cases where the resolver needs to be persisted internally. - * - * @interface * @template TYPE + * @interface */ -goog.promise.Resolver = function() {}; - - -/** - * The promise that created this resolver. - * @type {!goog.Promise} - */ -goog.promise.Resolver.prototype.promise; - - -/** - * Resolves this resolver with the specified value. - * @type {function((TYPE|goog.Promise|Thenable)=)} - */ -goog.promise.Resolver.prototype.resolve; - - -/** - * Rejects this resolver with the specified reason. - * @type {function(*=): void} - */ -goog.promise.Resolver.prototype.reject; +class Resolver { + constructor() { + /** + * The promise that created this resolver. + * @type {!GoogPromise} + */ + this.promise; + /** + * Resolves this resolver with the specified value. + * @type {function((TYPE|GoogPromise|Promise|IThenable|Thenable)=)} + */ + this.resolve; + /** + * Rejects this resolver with the specified reason. + * @type {function(*=): void} + */ + this.reject; + } +} + +exports = Resolver;