Skip to content

Commit 1906ea2

Browse files
committed
retrieved function deferred
1 parent b35e518 commit 1906ea2

File tree

1 file changed

+32
-34
lines changed

1 file changed

+32
-34
lines changed

lib/client/util/helpers.js

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,40 @@ const helpers = require('../../../build/helpers.js');
66
* @memberof helpers
77
* @constructor Deferred
88
*/
9-
class Deferred {
10-
constructor() {
11-
/**
12-
* A method to resolve the associate Promise with the value passed.
13-
* @method resolve
14-
* @memberof helpers.Deferred
15-
* @instance
16-
* @param {*} value - the value to resolve the promise with
17-
*/
18-
this.resolve = null;
9+
function Deferred() {
10+
/**
11+
* A method to resolve the associate Promise with the value passed.
12+
* @method resolve
13+
* @memberof helpers.Deferred
14+
* @instance
15+
* @param {*} value - the value to resolve the promise with
16+
*/
17+
this.resolve = null;
1918

20-
/**
21-
* A method to reject the associated Promise with the value passed.
22-
* If the promise is already settled it does nothing.
23-
* @method reject
24-
* @memberof helpers.Deferred
25-
* @instance
26-
* @param {*} reason - The reason for the rejection of the Promise.
27-
* Generally its an Error object. If however a Promise is passed, then the Promise
28-
* itself will be the reason for rejection no matter the state of the Promise.
29-
*/
30-
this.reject = null;
19+
/**
20+
* A method to reject the associated Promise with the value passed.
21+
* If the promise is already settled it does nothing.
22+
* @method reject
23+
* @memberof helpers.Deferred
24+
* @instance
25+
* @param {*} reason - The reason for the rejection of the Promise.
26+
* Generally its an Error object. If however a Promise is passed, then the Promise
27+
* itself will be the reason for rejection no matter the state of the Promise.
28+
*/
29+
this.reject = null;
3130

32-
/**
33-
* A newly created Promise object.
34-
* Initially in pending state.
35-
* @memberof helpers.Deferred
36-
* @member {Promise} promise
37-
* @instance
38-
*/
39-
this.promise = new Promise((resolve, reject) => {
40-
this.resolve = resolve;
41-
this.reject = reject;
42-
});
43-
Object.freeze(this);
44-
}
31+
/**
32+
* A newly created Promise object.
33+
* Initially in pending state.
34+
* @memberof helpers.Deferred
35+
* @member {Promise} promise
36+
* @instance
37+
*/
38+
this.promise = new Promise((resolve, reject) => {
39+
this.resolve = resolve;
40+
this.reject = reject;
41+
});
42+
Object.freeze(this);
4543
}
4644

4745
/**

0 commit comments

Comments
 (0)