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.

async.js 599B

12345678910111213141516171819202122232425262728293031323334
  1. var defer = require('./defer.js');
  2. // API
  3. module.exports = async;
  4. /**
  5. * Runs provided callback asynchronously
  6. * even if callback itself is not
  7. *
  8. * @param {function} callback - callback to invoke
  9. * @returns {function} - augmented callback
  10. */
  11. function async(callback)
  12. {
  13. var isAsync = false;
  14. // check if async happened
  15. defer(function() { isAsync = true; });
  16. return function async_callback(err, result)
  17. {
  18. if (isAsync)
  19. {
  20. callback(err, result);
  21. }
  22. else
  23. {
  24. defer(function nextTick_callback()
  25. {
  26. callback(err, result);
  27. });
  28. }
  29. };
  30. }