Front end of the Slack clone application.

asap.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /** PURE_IMPORTS_START ._AsapAction,._AsapScheduler PURE_IMPORTS_END */
  2. import { AsapAction } from './AsapAction';
  3. import { AsapScheduler } from './AsapScheduler';
  4. /**
  5. *
  6. * Asap Scheduler
  7. *
  8. * <span class="informal">Perform task as fast as it can be performed asynchronously</span>
  9. *
  10. * `asap` scheduler behaves the same as {@link async} scheduler when you use it to delay task
  11. * in time. If however you set delay to `0`, `asap` will wait for current synchronously executing
  12. * code to end and then it will try to execute given task as fast as possible.
  13. *
  14. * `asap` scheduler will do its best to minimize time between end of currently executing code
  15. * and start of scheduled task. This makes it best candidate for performing so called "deferring".
  16. * Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves
  17. * some (although minimal) unwanted delay.
  18. *
  19. * Note that using `asap` scheduler does not necessarily mean that your task will be first to process
  20. * after currently executing code. In particular, if some task was also scheduled with `asap` before,
  21. * that task will execute first. That being said, if you need to schedule task asynchronously, but
  22. * as soon as possible, `asap` scheduler is your best bet.
  23. *
  24. * @example <caption>Compare async and asap scheduler</caption>
  25. *
  26. * Rx.Scheduler.async.schedule(() => console.log('async')); // scheduling 'async' first...
  27. * Rx.Scheduler.asap.schedule(() => console.log('asap'));
  28. *
  29. * // Logs:
  30. * // "asap"
  31. * // "async"
  32. * // ... but 'asap' goes first!
  33. *
  34. * @static true
  35. * @name asap
  36. * @owner Scheduler
  37. */
  38. export var asap = /*@__PURE__*/ new AsapScheduler(AsapAction);
  39. //# sourceMappingURL=asap.js.map