UNPKG

@esutils/deferred

Version:

The deferred library implemented in Typescript

22 lines 537 B
/** * Copyright (C) 2022 Yonggang Luo <luoyonggang@gmail.com> * */ export class Deferred { constructor() { this.resolve = (value) => { this._resolve(value); }; this.reject = (reason) => { this._reject(reason); }; this._promise = new Promise((resolve, reject) => { this._resolve = resolve; this._reject = reject; }); } get promise() { return this._promise; } } //# sourceMappingURL=index.js.map