UNPKG

@esutils/deferred

Version:

The deferred library implemented in Typescript

26 lines 667 B
"use strict"; /** * Copyright (C) 2022 Yonggang Luo <luoyonggang@gmail.com> * */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Deferred = void 0; 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; } } exports.Deferred = Deferred; //# sourceMappingURL=index.js.map