npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@78nine/sideworker

v1.0.2

Published

SideWorker is a minimal JavaScript library to make Web Workers usage as painless as possible

Readme

SideWorker

SideWorker is a minimal JavaScript library to make using Web Workers as painless as possible.

It has been based on the WorkerB library by Luke Schaefer.

The main purpose of SideWorker is NOT having to create a seperate file for code that is run in a different thread. The Web Workers can be created inline to the main code and be communicated with asynchronously.

The idea is to consolidate the seperate script and the logic to interact with that script into one JS object.

Usage

Installation

SideWorker has no dependencies. You can install it via NPM:

npm install @79nine/SideWorker

and then use it in your code:

import SideWorker from '@78nine/sideworker' // ES Module style
// or
const SideWorker = require('@78nine/sideworker') // Node style

Another option is to simply include the minified file in your project (e.g. through the UnPKG):

<script src='https://unpkg.com/@78nine/sideworker'></script>

This option will expose a global SideWorker variable available on you web page.

Usage example:

// Create a new, empty SideWorker
const worker = new SideWorker();

// Define a method that will be run later in your code. This method needs:
  //  A name -> 'countToX'
  //  A function it will perform

worker.define('countToX', (x) => {
  for(let i = 0; i < x; i++) {
    continue;
  }
  return i;
}

// Use the defined method where you need it, and handle it's result via Promise:
worker.run.countToX(42).then((res) => console.log('X is', res));

// or with async/await syntax
const res = await worker.run.countToX(128);

console.log('Now the X is', res);

// The method's operation is non-blocking and performed in a seperate thread.

Options:

When creating an instance of the SideWorker you can pass it and object with two options:

debug

Default: false

If the debug option will be set to true the SideWorker will give you some additional information about it's work inside the browser's console.

const worker = new SideWorker({ debug: true });

init

Default: undefined

The init option can be used to pass a function, which then will be automatically called upon the Web Worker's creation. This can be very useful for instance to importScripts() and define worker-scoped variables or function needed later.

const worker = new SideWorker({
  init: () => {
    importScripts('https://unpkg.com/[email protected]/dist/faker.min.js');

    self.someGlobalFunction = () => {
      // do something
    }
  }
});

// and then inside another method:
worker.define('doSomething', () => {
  // `faker` is a globally available variable
  // `someGlobalFunction()` is a globally available function
});

It is also possible to pass additional arguments to the init function that are available in your main script's scope:

const answer = 42;
const persona = {
  firstName: 'Arthur',
  lastName: 'Dent'
}

const worker = new SideWorker({
  init: (num, obj) => {
    self.answer = num; // the `num` value is `42`
    self.him = obj; // the `obj` value is `{ firstName: 'Arthur', lastName: 'Dent' }`
  }
}, answer, persona);

Note: examples of all the basic functionality can be also explored in the examples folder.