This commit is contained in:
哆啦好梦
2023-03-03 18:30:03 +08:00
parent 5516155940
commit b3acd51825
7 changed files with 37 additions and 19 deletions

View File

@@ -680,16 +680,23 @@ class ExampleController extends Controller {
/**
* 任务
*/
someJob (args) {
someJob (args, event) {
let jobId = args.id;
if (args.type == 'timer') {
let myjob = new ChildJob();
myjob.exec('./jobs/example/timer', {jobId});
myjob.on('job-timer', (data) => {
Log.info('from TimerJob data:', data);
// 监听任务进度
const channel = 'controller.example.timerJobProgress';
myjob.on('job-timer-progress', (data) => {
Log.info('[main-process] from TimerJob data:', data);
// 发送数据到渲染进程
event.reply(`${channel}`, data)
})
}
return;
}
/**