gossamer/performance/mark
Records a point-in-time event on the performance timeline.
See Performance.mark on MDN.
Types
A mark on the performance timeline.
pub type Mark {
Mark(
name: String,
start_time: duration.Duration,
detail: option.Option(dynamic.Dynamic),
)
}
Constructors
-
Mark( name: String, start_time: duration.Duration, detail: option.Option(dynamic.Dynamic), )Arguments
- name
-
The mark’s name.
- start_time
-
When the mark was anchored, relative to
performance.time_origin. - detail
-
Arbitrary metadata attached at construction via
set_detail.Nonewhen nothing is attached.
Values
pub fn at(name: String, time: duration.Duration) -> Mark
Creates a Mark named name at a specific time relative to
performance.time_origin. Use
to backfill a mark for a previously-observed event. Negative
inputs are clamped to zero.
pub fn entries() -> List(Mark)
Returns every mark currently on the performance timeline.
pub fn entries_by_name(name: String) -> List(Mark)
Returns the marks on the performance timeline whose name matches
name.
pub fn from_entry(
entry: performance_entry.PerformanceEntry,
) -> Result(Mark, Nil)
Projects a
PerformanceEntry
to a Mark. Returns Error(Nil) if the entry isn’t a
mark.
pub fn new(name: String) -> Mark
Creates a Mark named name at the current high-resolution time.
Pass to record to write it to the timeline.
pub fn record(mark: Mark) -> Mark
Records the mark on the performance timeline. Returns the
Mark unchanged. In browser page contexts, panics when
the mark’s name matches a read-only attribute of the legacy
PerformanceTiming interface (e.g. "navigationStart").
pub fn set_detail(mark: Mark, detail: dynamic.Dynamic) -> Mark
Sets arbitrary metadata attached to the mark, exposed on the
recorded Mark’s detail field.
pub fn set_start_time(
mark: Mark,
start_time: duration.Duration,
) -> Mark
Sets the start time of the mark relative to
performance.time_origin.
Negative inputs are clamped to zero.