代码拉取完成,页面将自动刷新
'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;
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。