Giter VIP home page Giter VIP logo

flow-engine's Introduction

flow-engine

流程执行引擎,具体使用参考 test/unit/index.spec.js 测试用例和 demo

用法

正常使用

import runnable from 'flow-engine'

/**
 * aa1 aa2 aa3 先执行先返回,返回输入作为入参,然后到bb1,返回数据然后到cc1 cc2
 * /
const flowConfig = [
  [aa1, aa2(), aa3()],
  bb1,
  [cc1, cc2]
];

const param = {
  name: 123
}

runnable.excute(flowConfig, param ,()=>{
  console.log('callback executed!');
})

说明:原子函数 aa1,aa2 中数据执行流程正常 return 或者 promise.resolve,终止分支流程使用 promise.reject

调试模式使用

在初始化参数中可以传入 debug 参数:

  • mod: 调试模式

    • 1 表示调试模式,会先输出执行的当前函数和入参,然后进入 debugger 断点

    • 2 表示打印模式,输出执行的当前函数和入参,不会断点

  • disableNodes: 禁用节点名称,执行中会自动断掉对应节点流程

import runnable from 'flow-engine'

/**
 * aa1 aa2 aa3 先执行先返回,返回输入作为入参,然后到bb1,返回数据然后到cc1 cc2
 * /
const flowConfig = [
  [aa1, aa2(), aa3()],
  bb1,
  [cc1, cc2]
];

const ONLY_DEBUG = 1
const ONLY_CONSOLE = 2
const param = {
  name: 123,
  debug: {
    mode: ONLY_DEBUG,
    disableNodes:['xxxx']
    }
}

runnable.excute(flowConfig, param ,()=>{
  console.log('callback executed!');
})

flow-engine's People

Contributors

alicemayaya avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.