Skip to content

Commit b2e9db2

Browse files
authored
Add support for the .finally() method (#7)
1 parent f880881 commit b2e9db2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,9 @@ export default class PLazy extends Promise {
4040
this.#promise = this.#promise || new Promise(this.#executor);
4141
return this.#promise.catch(onRejected);
4242
}
43+
44+
finally(onFinally) {
45+
this.#promise = this.#promise || new Promise(this.#executor);
46+
return this.#promise.finally(onFinally);
47+
}
4348
}

0 commit comments

Comments
 (0)