@vyriy/timeout
v0.4.1
Published
Timeout utility for Vyriy projects
Downloads
3,022
Readme
@vyriy/timeout
Timeout utility for Vyriy projects.
Purpose
This package provides a small helper that waits for a given amount of time and then throws an error.
Install
With npm:
npm install @vyriy/timeoutWith Yarn:
yarn add @vyriy/timeoutUsage
import { timeout } from '@vyriy/timeout';
await timeout(5000, 'Request took too long');Exports
The package exposes both the root entry and the direct utility module:
import { timeout } from '@vyriy/timeout';API
timeout(time, message?)waits fortimemilliseconds and then throws an error.messageoverrides the default'Timeout error!'text.
