@vyriy/timeout
Part of Vyriy - a calm architecture toolkit for TypeScript, React, SSR, SSG, APIs, and cloud-ready apps.
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/timeout
With Yarn:
yarn add @vyriy/timeout
Usage
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.