PerformanceObserver
[<Interface>]
type PerformanceObserver =
static member Create<'Func, 'Result, 'This> (disconnect: unit -> unit, observe: U2<Options,Options2> -> unit, takeRecords: unit -> PerformanceEntry array, bind: 'Func -> 'Func, runInAsyncScope: Func<(obj array -> 'Result),'This option,obj array,'Result>, emitDestroy: unit -> PerformanceObserver, asyncId: unit -> float, triggerAsyncId: unit -> float) : PerformanceObserver
static member bind<'Func, 'ThisArg> (fn: 'Func, ?type: string, ?thisArg: 'ThisArg) : 'Func
abstract member disconnect () : unit
abstract member emitDestroy () : PerformanceObserver
abstract member observe (options: U2<Options,Options2>) : unit
abstract member takeRecords () : PerformanceEntry array| Assembly | Xantham.Fable.Node |
| Implements | AsyncResource |
| Attributes | [<Interface>] |
Declared inside
Observe |
Methods
static member Create<'Func, 'Result, 'This> (disconnect: unit -> unit, observe: U2<Options,Options2> -> unit, takeRecords: unit -> PerformanceEntry array, bind: 'Func -> 'Func, runInAsyncScope: Func<(obj array -> 'Result),'This option,obj array,'Result>, emitDestroy: unit -> PerformanceObserver, asyncId: unit -> float, triggerAsyncId: unit -> float) : PerformanceObserverstatic member bind<'Func, 'ThisArg> (fn: 'Func, ?type: string, ?thisArg: 'ThisArg) : 'Func
static member bind<'Func, 'ThisArg> (fn: 'Func, ?type: string, ?thisArg: 'ThisArg) : 'FuncBinds the given function to the current execution context.
@since v14.8.0, v12.19.0
| Parameter | |
|---|---|
fn | The function to bind to the current execution context. |
type | An optional name to associate with the underlying AsyncResource. |
abstract member disconnect () : unit
abstract member disconnect () : unitDisconnects the PerformanceObserver instance from all notifications.
@since v8.5.0
abstract member emitDestroy () : PerformanceObserver
abstract member emitDestroy () : PerformanceObserverCall all destroy hooks. This should only ever be called once. An error will be thrown if it is called more than once. This must be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.
Returns. A reference to asyncResource.
abstract member observe (options: U2<Options,Options2>) : unit
abstract member observe (options: U2<Options,Options2>) : unitSubscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified either by options.entryTypes or options.type:
import {
performance,
PerformanceObserver,
} from 'node:perf_hooks';
const obs = new PerformanceObserver((list, observer) => {
// Called once asynchronously. `list` contains three items.
});
obs.observe({ type: 'mark' });
for (let n = 0; n < 3; n++)
performance.mark(`test${n}`);
@since v8.5.0