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

taozen

v1.0.6

Published

一个轻量级的任务管理库

Readme

Taozen

A lightweight task management library providing simple, flexible, and efficient task flow control.

Features

  • Flexible task flow design: Build complex task flows with Tao and Zen combinations
  • State management: Built-in state storage and tracking, with React integration support
  • Dependency control: Support for step dependencies and ordered execution
  • Retry mechanism: Built-in configurable failure retry strategies
  • Timeout control: Timeout protection for long-running tasks
  • Event system: Complete event notification system to track task and step execution status
  • Pause/Resume/Cancel: Support for dynamic control of task execution flow

Installation

npm install taozen
# or
yarn add taozen
# or
pnpm add taozen

Basic Usage

import { Tao } from "taozen";

// Create a task
const tao = new Tao({ name: "Data Processing Task" });

// Register for state management
tao.register();

// Create the first step: fetch data
const fetchData = tao.zen("Fetch Data").exe(async () => {
  const response = await fetch("https://api.example.com/data");
  return response.json();
});

// Create the second step: process data (depends on the first step)
const processData = tao
  .zen("Process Data")
  .after(fetchData) // Set dependency
  .exe(async (input) => {
    // Get the result from the previous step
    const data = input.get(fetchData);
    // Process data
    return data.map((item) => ({ ...item, processed: true }));
  });

// Execute the task
try {
  const results = await tao.run();
  console.log("Task completed:", results);
} catch (error) {
  console.error("Task failed:", error);
}

Advanced Features

Retry Mechanism

const unreliableStep = tao
  .zen("Unreliable API Call")
  .exe(async () => {
    // Operation that might fail
    return fetch("https://unstable-api.example.com/data");
  })
  .retry({
    maxAttempts: 3, // Maximum retry attempts
    initialDelay: 1000, // Initial delay (milliseconds)
    backoffFactor: 2, // Delay growth factor
    maxDelay: 10000, // Maximum delay (milliseconds)
  });

Timeout Control

const longRunningStep = tao
  .zen("Time-consuming Operation")
  .exe(async () => {
    // Long-running operation
    return performLongCalculation();
  })
  .timeout(30000); // 30 seconds timeout

Event Listening

// Listen to task events
tao.on((event) => {
  console.log(
    `Event: ${event.type}, Time: ${new Date(event.timestamp).toISOString()}`
  );

  if (event.error) {
    console.error("Error:", event.error);
  }
});

// Listen to events from a specific step
tao.onZen(fetchData.getId(), (event) => {
  if (event.type === "zen:complete") {
    console.log("Data fetching completed:", event.data);
  }
});

Pause and Resume

// Pause execution
await tao.pause();

// Resume execution
await tao.resume();

// Cancel execution
await tao.cancel();

React Integration

Taozen can be easily integrated into React applications:

import { Tao } from "taozen";
import { useEffect, useState } from "react";

function TaskManager() {
  // Use Tao.use() to subscribe to task state changes
  const { taos } = Tao.use();

  // Get the state of a specific task
  const myTask = taos["task-id"];

  return (
    <div>
      {myTask && (
        <>
          <h2>{myTask.name}</h2>
          <p>Status: {myTask.status}</p>
          <p>Progress: {myTask.progress}%</p>

          <button onClick={() => Tao.pause(myTask.id)}>Pause</button>
          <button onClick={() => Tao.resume(myTask.id)}>Resume</button>
          <button onClick={() => Tao.cancel(myTask.id)}>Cancel</button>

          <h3>Steps:</h3>
          <ul>
            {myTask.zens.map((zen) => (
              <li key={zen.id}>
                {zen.name}: {zen.status}
                {zen.error && <p className="error">{zen.error}</p>}
              </li>
            ))}
          </ul>
        </>
      )}
    </div>
  );
}

Documentation

View the complete documentation and API reference: Taozen Documentation

License

MIT