Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
[Closure] Convert goog.promise.Resolver to goog.module and to ES6.
Browse files Browse the repository at this point in the history
RELNOTES: n/a

PiperOrigin-RevId: 412903963
Change-Id: Ib71d583308c6154c111c9e78f2c3c0aa97b0d25a
  • Loading branch information
Closure Team authored and copybara-github committed Nov 29, 2021
1 parent cd55edb commit 1720ce0
Showing 1 changed file with 26 additions and 29 deletions.
55 changes: 26 additions & 29 deletions closure/goog/promise/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<TYPE>}
*/
goog.promise.Resolver.prototype.promise;


/**
* Resolves this resolver with the specified value.
* @type {function((TYPE|goog.Promise<TYPE>|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<TYPE>}
*/
this.promise;
/**
* Resolves this resolver with the specified value.
* @type {function((TYPE|GoogPromise<TYPE>|Promise<TYPE>|IThenable|Thenable)=)}
*/
this.resolve;
/**
* Rejects this resolver with the specified reason.
* @type {function(*=): void}
*/
this.reject;
}
}

exports = Resolver;

0 comments on commit 1720ce0

Please sign in to comment.