Ohm-Management - Projektarbeit B-ME
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.d.ts 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 asapScheduler} scheduler.
  15. *
  16. * ## Examples
  17. * Use async scheduler to delay task
  18. * ```javascript
  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. * Use async scheduler to repeat task in intervals
  28. * ```javascript
  29. * function task(state) {
  30. * console.log(state);
  31. * this.schedule(state + 1, 1000); // `this` references currently executing Action,
  32. * // which we reschedule with new state and delay
  33. * }
  34. *
  35. * Rx.Scheduler.async.schedule(task, 3000, 0);
  36. *
  37. * // Logs:
  38. * // 0 after 3s
  39. * // 1 after 4s
  40. * // 2 after 5s
  41. * // 3 after 6s
  42. * ```
  43. *
  44. * @static true
  45. * @name async
  46. * @owner Scheduler
  47. */
  48. export declare const async: AsyncScheduler;