@wezom/toolkit-promise
v6.1.0
Published
Useful tools for working with Promises
Downloads
222
Maintainers
Readme
@wezom/toolkit-promise
Useful tools for working with Promises
| Statements | Branches | Functions | Lines | | --------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | | | | |
Table of Content:
Tools
promiseSleep()
Sleep some milliseconds and resolve promise
Parameters:
| Name | Data type | Argument | Default value | Description |
| ---- | --------- | -------- | ------------- | ----------- |
| ms | number
| | |
Returns: Promise<void>
Examples:
promiseSleep(500).then(() => tryAgainSomeMethod());
// or
async function fakeSubmit() {
await promiseSleep(300);
return true;
}
Contributing
Please fill free to create issues or send PR