Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

abort.js 497B

1234567891011121314151617181920212223242526272829
  1. // API
  2. module.exports = abort;
  3. /**
  4. * Aborts leftover active jobs
  5. *
  6. * @param {object} state - current state object
  7. */
  8. function abort(state)
  9. {
  10. Object.keys(state.jobs).forEach(clean.bind(state));
  11. // reset leftover jobs
  12. state.jobs = {};
  13. }
  14. /**
  15. * Cleans up leftover job by invoking abort function for the provided job id
  16. *
  17. * @this state
  18. * @param {string|number} key - job id to abort
  19. */
  20. function clean(key)
  21. {
  22. if (typeof this.jobs[key] == 'function')
  23. {
  24. this.jobs[key]();
  25. }
  26. }