Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document PerformanceMark/PerformanceMeasure.detail #21823

Merged
merged 3 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions files/en-us/web/api/performancemark/detail/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: PerformanceMark.detail
slug: Web/API/PerformanceMark/detail
page-type: web-api-instance-property
tags:
- API
- Property
- Reference
- Web Performance
browser-compat: api.PerformanceMark.detail
---

{{APIRef}}

The read-only **`detail`** property returns arbitrary metadata that has been included in the mark upon construction (either when using {{domxref("Performance.mark","performance.mark()")}} or the {{domxref("PerformanceMark.PerformanceMark","PerformanceMark()")}} constructor).
Elchi3 marked this conversation as resolved.
Show resolved Hide resolved

## Value

Returns the value it is set to (from `markOptions` of {{domxref("Performance.mark","performance.mark()")}} or the {{domxref("PerformanceMark.PerformanceMark","PerformanceMark()")}} constructor).

## Examples

The following example shows the use of the `detail` property.
Elchi3 marked this conversation as resolved.
Show resolved Hide resolved

```js
performance.mark("dog", { detail: "labrador" });

const dogEntries = performance.getEntriesByName("dog");

dogEntries[0].detail; // labrador
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
15 changes: 10 additions & 5 deletions files/en-us/web/api/performancemark/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@ browser-compat: api.PerformanceMark

## Instance properties

This interface has no properties but it extends the following {{domxref("PerformanceEntry")}} properties by qualifying/constraining the properties as follows:
This interface extends the following {{domxref("PerformanceEntry")}} properties by qualifying/constraining the properties as follows:

- {{domxref("PerformanceEntry.entryType")}}
- {{domxref("PerformanceEntry.entryType")}} {{ReadOnlyInline}}
- : Returns "`mark`".
- {{domxref("PerformanceEntry.name")}}
- {{domxref("PerformanceEntry.name")}} {{ReadOnlyInline}}
- : Returns the name given to the mark when it was created via a call to {{domxref("Performance.mark()","performance.mark()")}}.
- {{domxref("PerformanceEntry.startTime")}}
- {{domxref("PerformanceEntry.startTime")}} {{ReadOnlyInline}}
- : Returns the {{domxref("DOMHighResTimeStamp")}} when {{domxref("Performance.mark()","performance.mark()")}} was called.
- {{domxref("PerformanceEntry.duration")}}
- {{domxref("PerformanceEntry.duration")}} {{ReadOnlyInline}}
- : Returns "`0`". (A mark has no _duration_.)

This interface also supports the following properties:

- {{domxref("PerformanceMark.detail")}} {{ReadOnlyInline}}
- : Returns arbitrary metadata that has been included in the mark upon construction.

## Instance methods

This interface has no methods.
Expand Down
39 changes: 39 additions & 0 deletions files/en-us/web/api/performancemeasure/detail/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: PerformanceMeasure.detail
slug: Web/API/PerformanceMeasure/detail
page-type: web-api-instance-property
tags:
- API
- Property
- Reference
- Web Performance
browser-compat: api.PerformanceMeasure.detail
---

{{APIRef}}

The read-only **`detail`** property returns arbitrary metadata that has been included in the mark upon construction (when using {{domxref("Performance.measure","performance.measure()")}}.
Elchi3 marked this conversation as resolved.
Show resolved Hide resolved

## Value

Returns the value it is set to (from `markOptions` of {{domxref("Performance.measure","performance.measure()")}}).
Elchi3 marked this conversation as resolved.
Show resolved Hide resolved

## Examples

The following example shows the use of the `detail` property.
Elchi3 marked this conversation as resolved.
Show resolved Hide resolved

```js
performance.measure("dog", { detail: "labrador", start: 0, end: 12345 });

const dogEntries = performance.getEntriesByName("dog");

dogEntries[0].detail; // labrador
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
3 changes: 1 addition & 2 deletions files/en-us/web/api/performancemeasure/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ browser-compat: api.PerformanceMeasure

This interface defines:

- `PerformanceMeasure.detail`
- {{domxref("PerformanceMeasure.detail")}}
- : Contains arbitrary metadata about the measure.
This may be passed in as a property of the {{domxref("Performance.measure()","performance.measure()")}} argument `MeasureOptions`.

In addition, it extends the following {{domxref("PerformanceEntry")}} properties by qualifying/constraining the properties as follows:

Expand Down