Skip to content

Commit 7bf71e2

Browse files
committed
Remove finally polyfill
1 parent 73777b8 commit 7bf71e2

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

lib/runner.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports.SerializedRunner = class SerializedRunner {
77

88
run(...args) {
99
if(!this._pending) { // prevent concurrent execution
10-
this._pending = augment(this.asyncOp(...args)).
10+
this._pending = this.asyncOp(...args).
1111
finally(() => {
1212
this._pending = null;
1313
});
@@ -24,7 +24,7 @@ exports.SerializedRunner = class SerializedRunner {
2424
let enqueue = this._pending;
2525
let res = this.run(...args);
2626
if(enqueue) {
27-
this._queued = res = augment(res).
27+
this._queued = res = res.
2828
finally(() => {
2929
this._queued = null;
3030
}).
@@ -33,20 +33,3 @@ exports.SerializedRunner = class SerializedRunner {
3333
return res;
3434
}
3535
};
36-
37-
function augment(promise) {
38-
promise.finally = always;
39-
return promise;
40-
}
41-
42-
// poor man's `Promise#finally` polyfill
43-
function always(fn) {
44-
return this.
45-
then(res => {
46-
fn();
47-
return res;
48-
}, err => {
49-
fn();
50-
throw err;
51-
});
52-
}

0 commit comments

Comments
 (0)