Class PressureObserver
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalPressureObserver interface is part of the Compute Pressure API and is used to observe the pressure changes of system resources such as the CPU.
[Value("PressureObserver")]
public class PressureObserver
- Inheritance
-
PressureObserver
- Inherited Members
Remarks
-'PerformanceObserver'
-'MutationObserver'
-'ResizeObserver'
-'IntersectionObserver'
Constructors
PressureObserver()
public PressureObserver()
PressureObserver(PressureUpdateCallback)
NOTE
ExperimentalPressureObserver() constructor creates a new PressureObserver object to watch for changes to pressure changes of system resources such as the CPU.
public PressureObserver(PressureUpdateCallback callback)
Parameters
callbackPressureUpdateCallback
Remarks
Properties
KnownSources
NOTE
ExperimentalknownSources read-only property of the PressureObserver interface returns an array of the Source values supported by the user agent in alphabetical order.
[Value("knownSources")]
public static PressureSource[] KnownSources { get; }
Property Value
- PressureSource[]
An array of Source values.
Remarks
NOTE
The list of supported sources varies per browser, operating system, and hardware, and is evolving. This property is merely a hint about source types the user agents supports. Call Observe(PressureSource, PressureObserverOptions) and check for a
NotSupportedErrorto see if pressure observation is possible.
Methods
Disconnect()
NOTE
Experimentaldisconnect() method of the 'PressureObserver' interface stops the pressure observer callback from receiving pressure records from all sources.
[Value("disconnect")]
public GlobalObject.Undefined Disconnect()
Returns
Remarks
Observe(PressureSource, PressureObserverOptions)
NOTE
Experimentalobserve() method of the PressureObserver interface tells the pressure observer to start observing pressure changes. After this method is called, the observer will call its callback function when a pressure record for the specified source is observed.
[Value("observe")]
public Task<GlobalObject.Undefined> Observe(PressureSource source, PressureObserverOptions options = null)
Parameters
sourcePressureSourceoptionsPressureObserverOptions
Returns
- Task<GlobalObject.Undefined>
A Promise that fulfils with GlobalObject.Undefined.
Remarks
When a matching PressureRecord is obtained, the pressure observer's callback function is invoked.
TakeRecords()
NOTE
ExperimentaltakeRecords() method of the 'PressureObserver' interface returns the current list of pressure records stored in the pressure observer, emptying it out.
[Value("takeRecords")]
public List<PressureRecord> TakeRecords()
Returns
- List<PressureRecord>
An {{jsxref("Array")}} of PressureRecord objects.
Remarks
It is useful when you want to a stop observing a source but would like to be sure to get any records that have not yet been passed into the observer callback.
Unobserve(PressureSource)
NOTE
Experimentalunobserve() method of the 'PressureObserver' interface stops the pressure observer callback from receiving pressure records from the specified source.
[Value("unobserve")]
public GlobalObject.Undefined Unobserve(PressureSource source)
Parameters
sourcePressureSource