Front end of the Slack clone application.

async.d.ts 1.3KB

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