Skip to content

Commit

Permalink
retrieved function deferred
Browse files Browse the repository at this point in the history
  • Loading branch information
Snafkin547 committed May 23, 2024
1 parent b35e518 commit 1906ea2
Showing 1 changed file with 32 additions and 34 deletions.
66 changes: 32 additions & 34 deletions lib/client/util/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,40 @@ const helpers = require('../../../build/helpers.js');
* @memberof helpers
* @constructor Deferred
*/
class Deferred {
constructor() {
/**
* A method to resolve the associate Promise with the value passed.
* @method resolve
* @memberof helpers.Deferred
* @instance
* @param {*} value - the value to resolve the promise with
*/
this.resolve = null;
function Deferred() {
/**
* A method to resolve the associate Promise with the value passed.
* @method resolve
* @memberof helpers.Deferred
* @instance
* @param {*} value - the value to resolve the promise with
*/
this.resolve = null;

/**
* A method to reject the associated Promise with the value passed.
* If the promise is already settled it does nothing.
* @method reject
* @memberof helpers.Deferred
* @instance
* @param {*} reason - The reason for the rejection of the Promise.
* Generally its an Error object. If however a Promise is passed, then the Promise
* itself will be the reason for rejection no matter the state of the Promise.
*/
this.reject = null;
/**
* A method to reject the associated Promise with the value passed.
* If the promise is already settled it does nothing.
* @method reject
* @memberof helpers.Deferred
* @instance
* @param {*} reason - The reason for the rejection of the Promise.
* Generally its an Error object. If however a Promise is passed, then the Promise
* itself will be the reason for rejection no matter the state of the Promise.
*/
this.reject = null;

/**
* A newly created Promise object.
* Initially in pending state.
* @memberof helpers.Deferred
* @member {Promise} promise
* @instance
*/
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
Object.freeze(this);
}
/**
* A newly created Promise object.
* Initially in pending state.
* @memberof helpers.Deferred
* @member {Promise} promise
* @instance
*/
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
Object.freeze(this);
}

/**
Expand Down

0 comments on commit 1906ea2

Please sign in to comment.