1.0.2 • Published 11 months ago

my-workers v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

My Workers

A simple module for handling workers by organizing them into jobs that you can give a unique description for.

Installation

  1. Install the package using NPM:
npm install my-workers
  1. Import the package in your project using ES6:
import Job from "my-workers";

or using CommonJS:

const Job = require("my-workers");

Usage

import Job from "my-workers";

const job = new Job("JobName"); // Define the job with a descriptive ID.
const worker = job.add(
  "Tom", // The name of the worker.
  () => {
    console.log("Hello, Tom!");
  }, // The function/action to run.
  {
    interval: 5000, // Optional: By default the interval is 1000ms, but you can change it here.
  }
);

worker.start(); // Start or resume the worker.
worker.pause(); // Pause the worker.
job.remove("Tom"); // Completely remove the worker.

Questions

If you have any other questions or need help, feel free to open an issue on the GitHub repository.

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago