Skip to content

Commit

Permalink
Add new Promise method withResolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxodin committed Feb 2, 2024
1 parent 8f2694f commit 930f2e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Add this script on the top of your page:
<ul>
<li>allSettled
<li>any
<li>withResolvers
</ul>
<li>RegExp
<ul>
Expand Down
3 changes: 2 additions & 1 deletion mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ var lazyfills = {
},
Promise:{
allSettled:1,
any:1
any:1,
withResolvers:1,
},
RegExp:{
prototype:{
Expand Down
7 changes: 7 additions & 0 deletions polyfills/Promise/withResolvers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Promise.withResolvers || (Promise.withResolvers = function withResolvers() {
var a, b, c = new this(function (resolve, reject) {
a = resolve;
b = reject;
});
return {resolve: a, reject: b, promise: c};
});

0 comments on commit 930f2e4

Please sign in to comment.