Node-Red configuration
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

object_param.js 568B

1234567891011121314151617181920212223
  1. const CronJob = require('../lib/cron.js').CronJob;
  2. let isRunning = false;
  3. console.log('Before job instantiation');
  4. const job = new CronJob({
  5. cronTime: '* * * * * *',
  6. onTick: function() {
  7. const d = new Date();
  8. console.log('Check every second:', d, ', isRunning: ', isRunning);
  9. if (!isRunning) {
  10. isRunning = true;
  11. setTimeout(function() {
  12. console.log('Long running onTick complete:', new Date());
  13. isRunning = false;
  14. }, 3000);
  15. console.log('setTimeout triggered:', new Date());
  16. }
  17. }
  18. });
  19. console.log('After job instantiation');
  20. job.start();