-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
33 lines (25 loc) · 855 Bytes
/
Copy pathtest.js
File metadata and controls
33 lines (25 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { Scheduler } = require('../dist/')
let scheduler = new Scheduler()
scheduler.addTask({
task: async (my) =>
console.log(`task1 uuid:${my.uuid} run!`),
callback: async (my, result)=>
console.log(`task1 uuid:${my.uuid} callback run!`)
})
scheduler.addTask({
task: async (my) =>
console.log(`task2 uuid:${my.uuid} run!`),
callback: async (my, result)=>
console.log(`task2 uuid:${my.uuid} ca llback run!`),
delay: 5000
})
let taskHandler =
scheduler.addTask({
task: async (my) =>
console.log(`task3 uuid:${my.uuid} run!`),
callback: async (my, result)=> {
console.log(`task3 uuid:${my.uuid} callback run!`)
console.log(`task3 uuid:${my.uuid} callback isStopped: ${my.isStopped}`)
}
})
taskHandler.isStopped = true