JSPM

my-workers

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q22345F
  • License ISC

A simple module for handling workers.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (my-workers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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.