@bscotch/utility
Advanced tools
Comparing version 0.5.2 to 0.6.0
@@ -1,3 +0,5 @@ | ||
export declare function waitForMillis(millis: number): Promise<unknown>; | ||
export declare function waitForSeconds(seconds: number): Promise<unknown>; | ||
/** Get a promise that resolves in some number of milliseconds. */ | ||
export declare function resolveInMillis(millis: number): Promise<unknown>; | ||
/** Get a promise that resolves in some number of seconds. */ | ||
export declare function resolveInSeconds(seconds: number): Promise<unknown>; | ||
//# sourceMappingURL=wait.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.waitForSeconds = exports.waitForMillis = void 0; | ||
function waitForMillis(millis) { | ||
exports.resolveInSeconds = exports.resolveInMillis = void 0; | ||
/** Get a promise that resolves in some number of milliseconds. */ | ||
function resolveInMillis(millis) { | ||
return new Promise(res => setTimeout(res, millis)); | ||
} | ||
exports.waitForMillis = waitForMillis; | ||
function waitForSeconds(seconds) { | ||
return waitForMillis(seconds * 1000); | ||
exports.resolveInMillis = resolveInMillis; | ||
/** Get a promise that resolves in some number of seconds. */ | ||
function resolveInSeconds(seconds) { | ||
return resolveInMillis(seconds * 1000); | ||
} | ||
exports.waitForSeconds = waitForSeconds; | ||
exports.resolveInSeconds = resolveInSeconds; | ||
//# sourceMappingURL=wait.js.map |
@@ -0,1 +1,10 @@ | ||
# [0.6.0](https://github.com/bscotch/node-util/compare/v0.5.2...v0.6.0) (2020-11-11) | ||
### Features | ||
* Rename wait methods to 'resolveInSeconds' etc to be more explicit about what's happening. ([df5c6ab](https://github.com/bscotch/node-util/commit/df5c6abd41c4c60587e26d4a8e9f3fde04c67cea)) | ||
## [0.5.2](https://github.com/bscotch/node-util/compare/v0.5.1...v0.5.2) (2020-11-11) | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "@bscotch/utility", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "Bscotch Utilities: Methods for common Node.js needs.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -126,1 +126,17 @@ # Bscotch Utilities | ||
``` | ||
## Waits | ||
```ts | ||
import { | ||
resolveInMillis, | ||
resolveInSeconds, | ||
} from '@bscotch/utility'; | ||
async myAsynFunction(){ | ||
// Wait for 1 second | ||
await resolveInMillis(1000); | ||
// Wait for 1 second | ||
await resolveInSeconds(1); | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27492
297
142