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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@defiantcaptain/spork-js

v1.1.4

Published

This program is designed to work in tandum with the EXEC to provide a library to support a multi-tasking system. This does nothing meaningful outside of context

Downloads

5

Readme

#Spork-JS

Not designed for external conusmption as its usage won't make much sense.

 Spork.$('main.js').fork(1, (it) => {
     return ["bob"];
 }).join((results) => {
     process.send({event: 'done', results: results});
 }).error((err) => {
     console.log(err);
 }).start();

$('main.js') is the script to be executed, with Spork Spork::fork(n, callback) representing the number of main.js arguments to execute, and the callback designed to provide string[] as arguments to the program. join is called when all forked processes are completed, and the error is designed to provide details about the failure. start finalizes the process and beings the forking process formally.

start must always be invoked last, but fork, join and error can be added to the Spork in any order.

Objects and Whatnot

IDisposable

Interface to prevent objects from being reused. A Spork is intended to be used once only.

Spork implements IDisposable

Class that implements the forking logic.

  • static $(script : string) takes a string that is the script to be executed.
  • get eventID() : string is a uuidv1 of the Spork for mapping purposes.
  • isDisposed() : boolean is true if the object has been disposed. The object disposes itself.
  • join ((...) => void) is invoked when all forks are done.
  • error((...) => void) is invoked if there is a detected and expected error.
  • fork(n:number, (iteration) => string[]) is the forking operation that takes a number of iterations n and a closer that is invoked on each iteration to great a list of strings that serve as arguments.
  • start() to begin the forking process.
  • result(instanceID : string, value : any) is a callback to be invoked when a particular forked event has a result; each forked process as an instanceID for the fork.

All public facing functions, if invoked on a disposed object, will throw an error string this is dead. This object is not designed for reuse.

###Events SporkEvents.JOIN dispatched when all forks are done. SporkEvents.ERROR dispatched when an error happens. SporkProcessEvents.FORK_ME dispatched when we ask the governing application for forks. SporkProcessEvents.DONE is dispatched when a spawned process is complete.

###SporkHandler Namespace Contains a mapping object SporkMap that is a hash of outlying events. This is global, and each individual Spork deals with specific instances.