Table of Contents

Class PerformanceScriptTiming

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll
NOTE
Experimental
The PerformanceScriptTiming interface is specified in the Long Animation Frames API and provides metrics on individual scripts that contribute to long animation frames (LoAFs).
[Value("PerformanceScriptTiming")]
public class PerformanceScriptTiming : PerformanceEntry
Inheritance
PerformanceScriptTiming
Inherited Members

Remarks

Constructors

PerformanceScriptTiming()

public PerformanceScriptTiming()

Properties

Duration

[Value("duration")]
public Number Duration { get; }

Property Value

Number

EntryType

[Value("entryType")]
public string EntryType { get; }

Property Value

string

ExecutionStart

NOTE
Experimental
The executionStart read-only property of the PerformanceScriptTiming interface returns a Number indicating the time when the script compilation finished and execution started.
[Value("executionStart")]
public Number ExecutionStart { get; }

Property Value

Number

A Number.

Remarks

ForcedStyleAndLayoutDuration

NOTE
Experimental
The forcedStyleAndLayoutDuration read-only property of the PerformanceScriptTiming interface returns a Number indicating the total time spent, in milliseconds, by the script processing forced layout/style. See Avoid layout thrashing to understand what causes this.
[Value("forcedStyleAndLayoutDuration")]
public Number ForcedStyleAndLayoutDuration { get; }

Property Value

Number

A Number.

Remarks

Invoker

NOTE
Experimental
The invoker read-only property of the PerformanceScriptTiming interface returns a string value indicating the identity of the feature that, when invoked, ran the script.
[Value("invoker")]
public string Invoker { get; }

Property Value

string

A string, the structure of which depends on the script's InvokerType value:

invokerTypeinvoker string structureExample(s)
"user-callback"The object class the containing function is defined on, followed by a dot, followed by the function name."Window.requestAnimationFrame", "Window.setTimeout"
"event-listener"The TagName of the element, followed by a hash and its id (#id) or by src= and its src value in square brackets ([src=url]) if an id is not present, followed by a dot, followed by the event handler property."IMG#hero.onload", "IMG[src=https://example.com/img.jpg].onload", "BUTTON#updateCart.onclick"
"resolve-promise" or "reject-promise"The object and method that invoked the promise, followed by a dot, followed by "then" for "resolve-promise" and "catch" for "reject-promise"."Response.json.then", "Response.json.catch"
"classic-script" or "module-script"The source URL of the invoking script."https://example.com/scripts/myscript.js"

Remarks

InvokerType

NOTE
Experimental
The invokerType read-only property of the PerformanceScriptTiming interface returns a string value indicating the type of feature that, when invoked, ran the script.
[Value("invokerType")]
public ScriptInvokerType InvokerType { get; }

Property Value

ScriptInvokerType

A string indicating the invoker type of the script entry point. Possible values are:The structure of the Invoker value depends on the script's invokerType value. Check out the invoker page for more details.

Remarks

Name

[Value("name")]
public string Name { get; }

Property Value

string

PauseDuration

NOTE
Experimental
The pauseDuration read-only property of the PerformanceScriptTiming interface returns a Number indicating the total time, in milliseconds, spent by the script on "pausing" synchronous operations (for example, Alert() calls or synchronous XMLHttpRequests).
[Value("pauseDuration")]
public Number PauseDuration { get; }

Property Value

Number

A Number.

Remarks

SourceCharPosition

NOTE
Experimental
The sourceCharPosition read-only property of the PerformanceScriptTiming interface returns a number representing the script character position of the script feature that contributed to the long animation frame (LoAF).
[Value("sourceCharPosition")]
public long SourceCharPosition { get; }

Property Value

long

A number. Returns -1 if the script character position was not found.

Remarks

It is important to note that the reported function location will be the "entry point" of the script, that is, the top level of the stack, not any specific slow sub-function. See SourceFunctionName for more discussion around this.

-Long animation frame timing
-PerformanceLongAnimationFrameTiming

See also on MDN

SourceFunctionName

NOTE
Experimental
The sourceFunctionName read-only property of the PerformanceScriptTiming interface returns a string representing the name of the function that contributed to the long animation frame (LoAF).
[Value("sourceFunctionName")]
public string SourceFunctionName { get; }

Property Value

string

A string. Returns an empty string if the function name was not found.

Remarks

It is important to note that the reported function name will be the "entry point" of the script, that is, the top level of the stack, not any specific slow sub-function.

For example, if an event handler calls a top-level function, which then calls a slow sub-function, the source* fields will report the name and location of the top-level function, not the slow sub-function — the function that was passed to the platform API is always the one reported. This is because of performance reasons; a full stack trace is costly.

In the following snippet:

sourceFunctionName would report libFunc, not slowFunction.

-Long animation frame timing
-PerformanceLongAnimationFrameTiming

See also on MDN

SourceURL

NOTE
Experimental
The sourceURL read-only property of the PerformanceScriptTiming interface returns a string representing the URL of the script.
[Value("sourceURL")]
public string SourceURL { get; }

Property Value

string

A string. Returns an empty string if the URL was not found.

Remarks

It is important to note that the reported function location will be the "entry point" of the script, that is, the top level of the stack, not any specific slow sub-function. See SourceFunctionName for more discussion around this.

-Long animation frame timing
-PerformanceLongAnimationFrameTiming

See also on MDN

StartTime

[Value("startTime")]
public Number StartTime { get; }

Property Value

Number

WindowAttribution

NOTE
Experimental
The windowAttribution read-only property of the PerformanceScriptTiming interface returns an enumerated value describing the relationship of the container (i.e., either the top-level document or an {{htmlelement("iframe")}}) in which the long animation frame (LoAF)-causing script was executed, relative to the window running the current document.
[Value("windowAttribution")]
public ScriptWindowAttribution WindowAttribution { get; }

Property Value

ScriptWindowAttribution

An enumerated value, which can be one of:

Remarks

_window

NOTE
Experimental
The window read-only property of the PerformanceScriptTiming interface returns a reference to a Window object representing the window of the container (i.e., either the top-level document or an iframe) in which the long animation frame (LoAF)-causing script was executed.
[Value("window")]
public Window? _window { get; }

Property Value

Window

A Window object, or null if the window is no longer active (the object reference is a WeakRef).

Remarks

Methods

ToJSON()

NOTE
Experimental
The toJSON() method of the PerformanceScriptTiming interface is a {{Glossary("Serialization","serializer")}}; it returns a JSON representation of the PerformanceScriptTiming object.
[Value("toJSON")]
public Object ToJSON()

Returns

Object

A {{jsxref("JSON")}} object that is the serialization of the PerformanceScriptTiming object.

Remarks