import { workFlow } from 'flow-work';
const flow = workFlow('test');
flow
.tap('init')
.run('initChildren', (data:any, next:Function) => {
setTimeout(() => {
next(data);
}, 1000);
})
.run('initSlots', (data:any, next:Function) => {
setTimeout(() => {
next(data);
}, 1000);
});
flow
.tap('render')
.run('app', (data:any, next:Function) => {
setTimeout(() => {
next(data);
}, 1000);
})
.run('renderChildren', (data:any, next:Function) => {
setTimeout(() => {
next(data);
}, 1000);
})
.run('renderSlots', (data:any, next: Function) => {
setTimeout(() => {
next(data);
}, 1000);
});
flow.intercept({
run: (event) => {
const { runner, task, data } = event;
console.log(`${task.taskName} => ${runner.name}`, data);
},
register: ({ runner }) => {
console.log('register', runner);
},
call: (event) => {
console.log('call', event.flow);
}
});
flow.call('example', (lastTaskName:string, error:any) => {
console.log('finished', {lastTaskName, error})
});
-
Notifications
You must be signed in to change notification settings - Fork 0
zhuqingyv/flow-work
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
比Tapable更简单的任务管理流(单向链表)
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published