Skip to content

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
AssemblyXantham.Fable.Node
ImplementsAsyncResource
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) : PerformanceObserver
static member bind<'Func, 'ThisArg> (fn: 'Func, ?type: string, ?thisArg: 'ThisArg) : 'Func

Binds the given function to the current execution context.

@since v14.8.0, v12.19.0

Parameter
fnThe function to bind to the current execution context.
typeAn optional name to associate with the underlying AsyncResource.
abstract member disconnect () : unit

Disconnects the PerformanceObserver instance from all notifications.

@since v8.5.0

abstract member emitDestroy () : PerformanceObserver

Call 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

Subscribes 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

abstract member takeRecords () : PerformanceEntry array

@since v16.0.0

Returns. Current list of entries stored in the performance observer, emptying it out.