async-service-builder
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

async-service-builder

Build small async services

Installation

npm i async-service-builder

or

yarn add async-service-builder

Usage

import { build } from 'async-service-builder';

const serviceA = build(async() => {
    // do your async work
});

const serviceB = build(async() => {
    // do your async work
}, 10000);

serviceA(); // runs every 5 seconds
serviceB(); // runs every 10 seconds

API

build(worker: () => Promise, timeout = 5000): () => Promise

Build a new service which pauses for timeout between runs.

Won't crash when the worker throws.

It will terminate it self when the process exits.

Readme

Keywords

none

Package Sidebar

Install

npm i async-service-builder

Weekly Downloads

0

Version

1.0.0

License

GPL-3.0

Unpacked Size

3.59 kB

Total Files

8

Last publish

Collaborators

  • maxjoehnk