1.0.0 • Published 6 years ago

async-service-builder v1.0.0

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
6 years ago

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.

1.0.0

6 years ago