pressureObserverWrapper.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { Observable } from "./observable";
  2. /**
  3. * A wrapper for the experimental pressure api which allows a callback to be called whenever certain thresholds are met.
  4. */
  5. export declare class PressureObserverWrapper {
  6. private _observer;
  7. private _currentState;
  8. /**
  9. * An event triggered when the cpu usage/speed meets certain thresholds.
  10. * Note: pressure is an experimental API.
  11. */
  12. onPressureChanged: Observable<PressureRecord[]>;
  13. /**
  14. * A pressure observer will call this callback, whenever these thresholds are met.
  15. * @param options An object containing the thresholds used to decide what value to to return for each update property (average of start and end of a threshold boundary).
  16. */
  17. constructor(options?: PressureObserverOptions);
  18. /**
  19. * Returns true if PressureObserver is available for use, false otherwise.
  20. */
  21. static get IsAvailable(): boolean;
  22. /**
  23. * Method that must be called to begin observing changes, and triggering callbacks.
  24. * @param source defines the source to observe
  25. */
  26. observe(source: PressureSource): void;
  27. /**
  28. * Method that must be called to stop observing changes and triggering callbacks (cleanup function).
  29. * @param source defines the source to unobserve
  30. */
  31. unobserve(source: PressureSource): void;
  32. /**
  33. * Release the associated resources.
  34. */
  35. dispose(): void;
  36. }