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

@pwf/pure-work

v1.0.9

Published

Pure Vanilla Web App work processing

Downloads

290

Readme

Pure Work

Pure JavaScript Work Modules

Install

npm install @pwf/pure-work --save

What is it?

A set of standards-based modules that help in developing web apps.

1. Flow

Flow is a Workflow Engine with no dependencies, that enables you to run workflows by chaining JavaScript Promises.

Flow can be used to build complex workflows that are triggered by user actions or other events.

Every step in the workflow represents a piece of work that can have a UI representation.

1.1 Features

  1. Simplicity (just chain async methods/promises)
  2. Customizability (the only requirement is for each step to be an async method)
  3. Extensibility (hook into the event model, and extend each step with custom UI)
  4. 100% separation of workflow running (Flow) and UI handling (<flow-ui> web component).

1.2 Basic Usage (flow-ui Web Component)

The flow-ui Web Component can be used to run visual workflows.

It wraps the Flow class and provides a UI for running flows.

  render(){
    return html`<flow-ui type="full-page" .options=${this.options}></flow-ui>`
  }

  get options() {
    return new FlowOptions("test", this.runFlow.bind(this), (flow) => {
      this.flow = flow;
    });
  }

  async runFlow(){
    const f = this.flow;

    const person = {
      name: await f.ask("What's your name?", UI.text),
      email: await f.ask("And your email address?", UI.email);
    }

    await f.show(`name: ${person.name} (${person.email})`, {
      wait: 5000
    })

  }

1.3 Demo

See the demo page for a live demo.

1.4 Advanced Usage (Flow class)

Where flow-ui is a UI wrapper around the Flow class, the Flow class is UI-independent, and can be used to build everywhere.

import { Flow } from "pure-work/flow";

const options = new FlowOptions(
  "test",
  this.myFlowStartingpoint.bind(this),
  (flow) => {
    // flow.install("myMethod", this.myFlowMethod.bind(this))
  }
);

const flow = Flow.factory(options);
await flow.start();

2. Broker

A simple singleton message broker based on regular, vanilla DOM eventing.

Acts a a pub/sub messaging system, where actors can publish messages in topics, and consumers can subscribe to topics and listen for new messages on them.

Broker is available as a global singleton.

Subscribing to a topic

const broker = new Broker()
broker
  .subscribe(`my-topic`, async (data) => {
    // do something with the data
  })

Publishing on a topic

broker.publish(`my-topic`, {
  my: "data"
})