1 Star 0 Fork 0

拽,拽起来拽起来/motic-bpmn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
listen.js 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
拽,拽起来拽起来 提交于 2018-12-15 10:37 . init
'use strict';
const Bpmn = require('bpmn-engine');
const EventEmitter = require('events').EventEmitter;
const processXml = `
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process id="theProcess" isExecutable="true">
<dataObjectReference id="inputFromUserRef" dataObjectRef="inputFromUser" />
<dataObject id="inputFromUser" />
<startEvent id="theStart" />
<userTask id="userTask">
<ioSpecification id="inputSpec">
<dataOutput id="userInput" />
</ioSpecification>
<dataOutputAssociation id="associatedWith" sourceRef="userInput" targetRef="inputFromUserRef" />
</userTask>
<endEvent id="theEnd" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="userTask" />
<sequenceFlow id="flow2" sourceRef="userTask" targetRef="theEnd" />
</process>
</definitions>`;
const engine = new Bpmn.Engine({
name: 'listen example',
source: processXml
});
const listener = new EventEmitter();
listener.once('wait-userTask', (task) => {
task.signal({
sirname: 'von Rosen'
});
});
listener.on('taken', (flow) => {
console.log(`flow <${flow.id}> was taken`);
});
engine.once('end', (definition) => {
console.log(`User sirname is ${definition.variables.inputFromUser.sirname}`);
});
engine.execute({
listener: listener
}, (err, instance) => {
if (err) throw err;
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fadaxy/motic-bpmn.git
git@gitee.com:fadaxy/motic-bpmn.git
fadaxy
motic-bpmn
motic-bpmn
master

搜索帮助