0

nodejs告诉我 当我想执行job.cancel()时无法读取未定义的属性“取消”

var schedule = require('node-schedule');


test = schedule.scheduleJob({second: 2, hour: 
dataA[0].on_h , minute: dataA[0].on_m, dayOfWeek: 
timerSD.day}, function(){ 
    console.log(now+': Timer automatic ON  - SD: '+x+ "timer ID"+dataA[0].ID);
    db.setStatus(x, 1);
});
test.cancel();
4

1 回答 1

0

我做了一个重新安排的解决方法。这有效:

test = schedule.scheduleJob({second: 3, hour: dataA[0].off_h , minute: dataA[0].off_m, dayOfWeek: timerSD.day}, function() {
                console.log(now+': Timer automatic OFF - SD: '+x+ "timer ID."+dataA[0].ID);
                db.setStatus(x, 0);
            });
test.reschedule(true);
于 2019-04-28T15:43:57.857 回答