Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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();