-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.js
22 lines (21 loc) · 998 Bytes
/
global.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//jshint -W098
/**@module ForkedOutPromise:globalDoc
* @author fbarda [email protected]
*/
/**@typedef {Object} ForkedOutPromiseInstance - An object containing a promise and the promise's resolve and reject functions.
* @prop {Promise<*>} promise - Designed to return via a callback-style async function. Use `this.resolve` and `this.reject` to control the promise via a callback.
* @prop {(value:*=)=>void} resolve Makes the [promise]{@link ForkedOutPromiseInstance#promise} resolve with the given argument.
* @prop {(reason:*=)=>void} reject Makes the [promise]{@link ForkedOutPromiseInstance#promise} reject with the given error argument.
*/
/** @class */
class ForkedOutPromise {
/** @returns {ForkedOutPromiseInstance} A new {@linkplain ForkedOutPromise} object. */
constructor() {
this.promise = new Promise(
(resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
}
);
}
}