-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for delay function
Adds support for providing a delay function which returns the delay value allowing customization of the polling interval. This can be utilized to implement polling with exponential backoff (i.e. where the polling interval steadily increases over time).
- Loading branch information
1 parent
5de38f5
commit 19ca02d
Showing
5 changed files
with
155 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
async function a(a,i,t=(()=>!1)){i=Math.max(0,i);do{if(await a(),await t())break;await new Promise((a=>setTimeout(a,i)))}while(!await t())}export{a as poll}; | ||
async function a(a,t,e=(()=>!1)){do{if(await a(),await e())break;const i="number"==typeof t?t:t();await new Promise((a=>setTimeout(a,Math.max(0,i))))}while(!await e())}export{a as poll}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.