Skip to content

Commit 08ab5f8

Browse files
committed
Add spacing between methods
1 parent 42349c4 commit 08ab5f8

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

JavaScript/1-object.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
const asyncResult = () => ({
44
value: undefined,
55
onDone: null,
6+
67
done(callback) {
78
this.onDone = callback;
89
return this;
910
},
11+
1012
resolve(value) {
1113
this.value = value;
1214
if (this.onDone) this.onDone(value);

JavaScript/2-after.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ const asyncResult = () => ({
44
value: undefined,
55
onDone: null,
66
resolved: false,
7+
78
done(callback) {
89
this.onDone = callback;
910
if (this.resolved) callback(this.value);
1011
return this;
1112
},
13+
1214
resolve(value) {
1315
this.value = value;
1416
this.resolved = true;

JavaScript/3-deferred.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,38 @@ const deferred = () => ({
99
onDone: null,
1010
onFail: null,
1111
status: DEFERRED_PENDING,
12+
1213
isPending() {
1314
return this.status === DEFERRED_PENDING;
1415
},
16+
1517
isResolved() {
1618
return this.status === DEFERRED_RESOLVED;
1719
},
20+
1821
isRejected() {
1922
return this.status === DEFERRED_REJECTED;
2023
},
24+
2125
done(callback) {
2226
this.onDone = callback;
2327
if (this.isResolved()) callback(this.value);
2428
return this;
2529
},
30+
2631
fail(callback) {
2732
this.onFail = callback;
2833
if (this.isRejected()) callback(this.value);
2934
return this;
3035
},
36+
3137
resolve(value) {
3238
this.value = value;
3339
this.status = DEFERRED_RESOLVED;
3440
if (this.onDone) this.onDone(value);
3541
return this;
3642
},
43+
3744
reject(value) {
3845
this.value = value;
3946
this.status = DEFERRED_REJECTED;

0 commit comments

Comments
 (0)