em-pipeline
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

em-pipeline

API

  1. next : 方法用于执行下一个任务
  1. skip : 方法用于执行下下个任务
  1. run : 开始运行任务
  1. tap : 注册任务

DEMO

import { PipeLine } from 'em-pipeline';

const task1 = new PipeLine<{
  name: string;
}>();

task1
  .tap<{
    age: number;
  }>('测试1', (app, { next, skip }) => {
    console.log('run111');
    next({
      age: 18,
    });
  })
  .tap<{
    sex: string;
  }>('测试2', (app, { next, skip }) => {
    console.log('run222');
    const { age, name } = app;
    skip({
      sex: 'man',
    });
  })
  .tap('测试5', (app, { next }) => {
    console.log(app);
    next();
  })
  .tap('测试6', (app) => {
    console.log(app);
  });

task1.run({
  name: '1',
});

Readme

Keywords

none

Package Sidebar

Install

npm i em-pipeline

Weekly Downloads

0

Version

0.1.2

License

ISC

Unpacked Size

7.59 kB

Total Files

10

Last publish

Collaborators

  • lizhiyu