API
This documentation helps using microjob
with ease, involving simple and quick examples.
job
job can be required directly from microjob:
const {job} = require('microjob')
It's a function with this signature:
function job<T>(handler: <T>(data?: any) => void, config?: Config): Promise<T>;
Config is defined as an object:
Config<T = {}, U = {}> {
ctx?: T
data?: U
}
To know how to use it, please refer to the Job Guide
start
start can be required directly from microjob:
const {start} = require('microjob')
Its signature:
function start(config: SetupConfig): Promise<void>;
SetupConfig is defined as an object:
SetupConfig {
maxWorkers?: number
}
To know how to use it, please refer to the Setup Guide
stop
stop can be required directly from microjob:
const {stop} = require('microjob')
It's a function with this signature:
function stop(): Promise<void>;
To know how to use it, please refer to the Teardown Guide