Class PerformanceScriptTiming
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalPerformanceScriptTiming 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
EntryType
[Value("entryType")]
public string EntryType { get; }
Property Value
ExecutionStart
NOTE
ExperimentalexecutionStart 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
Remarks
ForcedStyleAndLayoutDuration
NOTE
ExperimentalforcedStyleAndLayoutDuration 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
Remarks
Invoker
NOTE
Experimentalinvoker 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:
invokerTypeinvokerstring 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 bysrc=and itssrcvalue in square brackets ([src=url]) if anidis 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
ExperimentalinvokerType 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
invokerTypevalue. Check out theinvokerpage for more details.
Remarks
Name
[Value("name")]
public string Name { get; }
Property Value
PauseDuration
NOTE
ExperimentalpauseDuration 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
Remarks
SourceCharPosition
NOTE
ExperimentalsourceCharPosition 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
-1if 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
SourceFunctionName
NOTE
ExperimentalsourceFunctionName 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
SourceURL
NOTE
ExperimentalsourceURL 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
StartTime
[Value("startTime")]
public Number StartTime { get; }
Property Value
WindowAttribution
NOTE
ExperimentalwindowAttribution 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
Experimentalwindow 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
nullif the window is no longer active (the object reference is aWeakRef).
Remarks
Methods
ToJSON()
NOTE
ExperimentaltoJSON() 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.