Front end of the Slack clone application.

async.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /** PURE_IMPORTS_START ._AsyncAction,._AsyncScheduler PURE_IMPORTS_END */
  2. import { AsyncAction } from './AsyncAction';
  3. import { AsyncScheduler } from './AsyncScheduler';
  4. /**
  5. *
  6. * Async Scheduler
  7. *
  8. * <span class="informal">Schedule task as if you used setTimeout(task, duration)</span>
  9. *
  10. * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript
  11. * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating
  12. * in intervals.
  13. *
  14. * If you just want to "defer" task, that is to perform it right after currently
  15. * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),
  16. * better choice will be the {@link asap} scheduler.
  17. *
  18. * @example <caption>Use async scheduler to delay task</caption>
  19. * const task = () => console.log('it works!');
  20. *
  21. * Rx.Scheduler.async.schedule(task, 2000);
  22. *
  23. * // After 2 seconds logs:
  24. * // "it works!"
  25. *
  26. *
  27. * @example <caption>Use async scheduler to repeat task in intervals</caption>
  28. * function task(state) {
  29. * console.log(state);
  30. * this.schedule(state + 1, 1000); // `this` references currently executing Action,
  31. * // which we reschedule with new state and delay
  32. * }
  33. *
  34. * Rx.Scheduler.async.schedule(task, 3000, 0);
  35. *
  36. * // Logs:
  37. * // 0 after 3s
  38. * // 1 after 4s
  39. * // 2 after 5s
  40. * // 3 after 6s
  41. *
  42. * @static true
  43. * @name async
  44. * @owner Scheduler
  45. */
  46. export var async = /*@__PURE__*/ new AsyncScheduler(AsyncAction);
  47. //# sourceMappingURL=async.js.map