Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: EventTarget
Source: JSObjects/Performance.cs
MDN Reference: Performance on MDN
The Performance interface provides access to performance-related information for the current page. https://developer.mozilla.org/en-US/docs/Web/API/Performance
| Signature |
Description |
Performance(SpawnJSObjectReference _ref) |
Deserialization constructor |
| Property |
Type |
Access |
Description |
EventCounts |
EventCounts |
get |
|
Memory |
SpawnJSObject |
get |
|
Navigation |
PerformanceNavigation |
get |
|
TimeOrigin |
Number |
get |
|
Timing |
PerformanceTiming |
get |
|
| Method |
Return Type |
Description |
ClearMarks() |
void |
|
ClearMeasures() |
void |
|
ClearResourceTimings() |
void |
|
GetEntries() |
void |
|
GetEntriesByName() |
void |
|
GetEntriesByType() |
void |
|
Mark() |
void |
|
Measure() |
void |
|
Now() |
double |
Returns a DOMHighResTimeStamp representing the number of milliseconds elapsed since a reference instant. |
SetResourceTimingBufferSize() |
void |
|
ToJSON() |
void |
|
| Event |
Type |
Description |
OnResourceTimingBufferFull |
ActionEvent<Event> |
The resourcetimingbufferfull event is fired when the browser's resource timing buffer is full. |
// Get the Performance object from the global scope
using var performance = JS.Get<Performance>("performance");
// Get a high-resolution timestamp (milliseconds since page load)
double now = performance.Now();
Console.WriteLine($"Time since page load: {now}ms");
// Measure execution time of an operation
double start = performance.Now();
// ... perform some work ...
double end = performance.Now();
Console.WriteLine($"Operation took {end - start:F2}ms");