Skip to content

Commit

Permalink
Remove event macro (batch #1) (mdn#14501)
Browse files Browse the repository at this point in the history
* Replace {{event("visibilitychange")}} with domxref

* Revert "Replace {{event("visibilitychange")}} with domxref"

This reverts commit f25e494.

* Replace {{event)}} with domxref

* Typo fix
  • Loading branch information
teoli2003 authored Apr 1, 2022
1 parent 6197c21 commit ac7a7a7
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion files/en-us/mozilla/firefox/releases/18/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Firefox 18 was released on January 8, 2013. This article lists key changes that
- `window.devicePixelRatio` has been landed. ({{bug("564815")}})
- The MacOS X backend for `window.navigator.battery` has been implemented. ({{bug("696045")}})
- {{domxref("BlobBuilder", "MozBlobBuilder")}} is removed. Developers need to use {{domxref("Blob")}} constructor for creating a `Blob` object. ({{bug("744907")}})
- The {{event("visibilitychange")}} event and the [Page Visibility API](/en-US/docs/Web/API/Page_Visibility_API) has been unprefixed ({{bug("812086")}}).
- The {{domxref("document.visibilitychange_event", "visibilitychange")}} event and the [Page Visibility API](/en-US/docs/Web/API/Page_Visibility_API) has been unprefixed ({{bug("812086")}}).
- {{domxref("TextDecoder")}} and {{domxref("TextEncoder")}} have been added. Note that the implementation and spec of these evolved and have been changed in Firefox 19 ({{bug("764234")}}).
- `HTMLMediaElement.src` has been separate in two properties: the standard `src` property, dealing with {{domxref("DOMString")}}, and the prefixed `mozSrcObject` property, dealing with [media streams](/en-US/docs/Web/API/Media_Streams_API) ({{bug("792665")}}).
- Support for [transferable objects.](/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#passing_data_by_transferring_.c2.a0ownership_%28transferable_objects%29)
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/mozilla/firefox/releases/59/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ _No changes._

#### Media and WebRTC

- The {{domxref("MediaStreamTrack")}} property {{domxref("MediaStreamTrack.muted")}}, along with the events {{event("mute")}} and {{event("unmute")}} and the corresponding event handlers, {{domxref("MediaStreamTrack.mute_event", "onmute")}} and {{domxref("MediaStreamTrack.unmute_event", "onunmute")}}, have been implemented. A track's `muted` state indicates that the track is not currently able to provide media data.
- The {{domxref("MediaStreamTrack")}} property {{domxref("MediaStreamTrack.muted")}}, along with the events {{domxref("MediaStreamTrack.mute_event", "mute")}} and {{domxref("MediaStreamTrack.unmute_event", "unmute")}} and the corresponding event handlers, {{domxref("MediaStreamTrack.mute_event", "onmute")}} and {{domxref("MediaStreamTrack.unmute_event", "onunmute")}}, have been implemented. A track's `muted` state indicates that the track is not currently able to provide media data.

> **Note:** The `muted` state of a track isn't useful for what's typically thought of as muting and unmuting a track. Instead, use the {{domxref("MediaStreamTrack.enabled", "enabled")}} property; setting `enabled` to `false` causes the track to output only empty frames.
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/idbversionchangeevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ _Also inherits properties from its parent, {{domxref("Event")}} interface._

- {{ domxref("IDBVersionChangeEvent.version") }} {{readonlyInline}} {{deprecated_inline}}

- : The new version of the database in a {{event("versionchange")}} transaction.
- : The new version of the database in a {{domxref("IDBDatabase.versionchange_event", "versionchange")}} transaction.

> **Warning:** While this property is still implemented in older browsers, the latest specification replaces it with the `oldVersion` and `newVersion` attributes. See the compatibility table to know what browsers support them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function startup() {
}
```

First, a reference to the content wrapping {{HTMLElement("main")}} element is obtained, so we can insert our content into it. Then we set up an event listener for the {{event("visibilitychange")}} event. This event is sent when the document becomes hidden or visible, such as when the user switches tabs in their browser. The Intersection Observer API doesn't take this into account when detecting intersection, since intersection isn't affected by page visibility. Therefore, we need to pause our timers while the page is tabbed out; hence this event listener.
First, a reference to the content wrapping {{HTMLElement("main")}} element is obtained, so we can insert our content into it. Then we set up an event listener for the {{domxref("document.visibilitychange_event", "visibilitychange")}} event. This event is sent when the document becomes hidden or visible, such as when the user switches tabs in their browser. The Intersection Observer API doesn't take this into account when detecting intersection, since intersection isn't affected by page visibility. Therefore, we need to pause our timers while the page is tabbed out; hence this event listener.

Next we set up the options for the {{domxref("IntersectionObserver")}} which will monitor target elements (ads, in our case) for intersection changes relative to the document. The options are configured to watch for intersections with the document's viewport (by setting `root` to `null`). We have no margins to extend or contract the intersection root's rectangle; we want to match the boundaries of the document's viewport exactly for intersection purposes. And the `threshold` is set to an array containing the values 0.0 and 0.75; this will cause our callback to execute whenever a targeted element becomes completely obscured or first starts to become unobscured (intersection ratio 0.0) or passes through 75% visible in either direction (intersection ratio 0.75).

Expand All @@ -265,7 +265,7 @@ Finally, we set up an interval which triggers once a second to handle any necess

#### Handling document visibility changes

Let's take a look at the handler for the {{event("visibilitychange")}} event. Our script receives this event when the document itself becomes visible or invisible. The most important scenario here is when the user switches tabs. Since Intersection Observer only cares about the intersection between the targeted elements and the intersection root, and not the tab's visibility (which is a different issue entirely), we need to use the [Page Visibility API](/en-US/docs/Web/API/Page_Visibility_API) to detect these tab switches and disable our timers for the duration.
Let's take a look at the handler for the {{domxref("document.visibilitychange_event", "visibilitychange")}} event. Our script receives this event when the document itself becomes visible or invisible. The most important scenario here is when the user switches tabs. Since Intersection Observer only cares about the intersection between the targeted elements and the intersection root, and not the tab's visibility (which is a different issue entirely), we need to use the [Page Visibility API](/en-US/docs/Web/API/Page_Visibility_API) to detect these tab switches and disable our timers for the duration.

```js
function handleVisibilityChange() {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/media_streams_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Early versions of the Media Capture and Streams API specification included separ
- {{event("addtrack")}}
- {{event("ended")}}
- {{event("muted")}}
- {{event("overconstrained")}}
- {{domxref("MediaStreamTrack.overconstrained_event", "overconstrained")}}
- {{event("removetrack")}}
- {{event("started")}}
- {{event("unmuted")}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object that contains the data. This occurs in four situations:
produce multiple same-length blobs plus other shorter blobs as well.

> **Note:** The {{domxref("Blob")}} containing the media data is available in the
> {{event("dataavailable")}} event's `data` property.
> {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event's `data` property.
## Syntax

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/mediarecorder/error_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ the value of {{domxref("DOMException.name", "MediaRecorderErrorEvent.error.name"
- `UnknownError`
- : An non-security related error occurred that cannot otherwise be categorized.
Recording stops, the `MediaRecorder`'s {{domxref("MediaRecorder.state",
"state")}} becomes `inactive`, one last {{event("dataavailable")}} event is
"state")}} becomes `inactive`, one last {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event is
sent to the `MediaRecorder` with the remaining received data, and finally a
{{event("stop")}} event is sent.

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/mediarecorder/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The **`MediaRecorder`** interface of the [MediaStream Recording API](/en-US/docs
- {{domxref("MediaRecorder.start()")}}
- : Begins recording media; this method can optionally be passed a `timeslice` argument with a value in milliseconds. If this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk.
- {{domxref("MediaRecorder.stop()")}}
- : Stops recording, at which point a {{event("dataavailable")}} event containing the final `Blob` of saved data is fired. No more recording occurs.
- : Stops recording, at which point a {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event containing the final `Blob` of saved data is fired. No more recording occurs.

## Static methods

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/mediarecorder/requestdata/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs the following steps:
1. If {{domxref("MediaRecorder.state")}} is "inactive", raise a DOM
`InvalidState` error and terminate these steps. If
{{domxref("MediaRecorder.state")}} is not "inactive", continue to the next step.
2. Raise a {{event("dataavailable")}} event containing a {{domxref("Blob")}} of the
2. Raise a {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event containing a {{domxref("Blob")}} of the
currently captured data (the Blob is available under the event's `data`
attribute.)
3. Create a new Blob and place subsequently captured data into it.
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/mediarecorder/start/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ is `inactive`, `start()` sets the `state` to
`Blob` is created and the data is collected in it until the time slice period
elapses or the source media ends. Each time a `Blob` is filled up to that
point (the timeslice duration or the end-of-media, if no slice duration was provided), a
{{event("dataavailable")}} event is sent to the `MediaRecorder` with the
{{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event is sent to the `MediaRecorder` with the
recorded data. If the source is still playing, a new `Blob` is created and
recording continues into that, and so forth.

When the source stream ends, `state` is set to `inactive` and
data gathering stops. A final {{event("dataavailable")}} event is sent to the
data gathering stops. A final {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event is sent to the
`MediaRecorder`, followed by a {{event("stop")}} event.

> **Note:** If the browser is unable to start recording or continue
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/mediarecordererrorevent/error/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ method references.
- `UnknownError`
- : A non-security related error occurred that cannot otherwise be categorized.
Recording stops, the `MediaRecorder`'s {{domxref("MediaRecorder.state",
"state")}} becomes `inactive`, one last {{event("dataavailable")}} event is
"state")}} becomes `inactive`, one last {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event is
sent to the `MediaRecorder` with the remaining received data, and finally a
{{event("stop")}} event is sent.

Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/mediastream_recording_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ The **MediaStream Recording API**, sometimes referred to as the _Media Recording

## Basic concepts

The MediaStream Recording API is comprised of a single major interface, {{domxref("MediaRecorder")}}, which does all the work of taking the data from a {{domxref("MediaStream")}} and delivering it to you for processing. The data is delivered by a series of {{event("dataavailable")}} events, already in the format you specify when creating the `MediaRecorder`. You can then process the data further or write it to file as desired.
The MediaStream Recording API is comprised of a single major interface, {{domxref("MediaRecorder")}}, which does all the work of taking the data from a {{domxref("MediaStream")}} and delivering it to you for processing. The data is delivered by a series of {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} events, already in the format you specify when creating the `MediaRecorder`. You can then process the data further or write it to file as desired.

### Overview of the recording process

The process of recording a stream is simple:

1. Set up a {{domxref("MediaStream")}} or {{domxref("HTMLMediaElement")}} (in the form of an {{HTMLElement("audio")}} or {{HTMLElement("video")}} element) to serve as the source of the media data.
2. Create a {{domxref("MediaRecorder")}} object, specifying the source stream and any desired options (such as the container's MIME type or the desired bit rates of its tracks).
3. Set {{domxref("MediaRecorder.dataavailable_event", "ondataavailable")}} to an event handler for the {{event("dataavailable")}} event; this will be called whenever data is available for you.
3. Set {{domxref("MediaRecorder.dataavailable_event", "ondataavailable")}} to an event handler for the {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event; this will be called whenever data is available for you.
4. Once the source media is playing and you've reached the point where you're ready to record video, call {{domxref("MediaRecorder.start()")}} to begin recording.
5. Your {{event("dataavailable")}} event handler gets called every time there's data ready for you to do with as you will; the event has a `data` attribute whose value is a {{domxref("Blob")}} that contains the media data. You can force a `dataavailable` event to occur, thereby delivering the latest sound to you so you can filter it, save it, or whatever.
5. Your {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event handler gets called every time there's data ready for you to do with as you will; the event has a `data` attribute whose value is a {{domxref("Blob")}} that contains the media data. You can force a `dataavailable` event to occur, thereby delivering the latest sound to you so you can filter it, save it, or whatever.
6. Recording stops automatically when the source media stops playing.
7. You can stop recording at any time by calling {{domxref("MediaRecorder.stop()")}}.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function startRecording(stream, lengthInMS) {
- Line 3
- : Creates an empty array, `data`, which will be used to hold the {{domxref("Blob")}}s of media data provided to our {{domxref("MediaRecorder.dataavailable_event", "ondataavailable")}} event handler.
- Line 5
- : Sets up the handler for the {{event("dataavailable")}} event. The received event's `data` property is a {{domxref("Blob")}} that contains the media data. The event handler pushes the `Blob` onto the `data` array.
- : Sets up the handler for the {{domxref("MediaRecorder.dataavailable_event", "dataavailable")}} event. The received event's `data` property is a {{domxref("Blob")}} that contains the media data. The event handler pushes the `Blob` onto the `data` array.
- Lines 6-7
- : Starts the recording process by calling {{domxref("MediaRecorder.start", "recorder.start()")}}, and outputs a message to the log with the updated state of the recorder and the number of seconds it will be recording.
- Lines 9-12
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/mediastreamtrack/muted/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A {{jsxref('Boolean')}} which is `true` if the track is currently muted, or
`false` if the track is currently unmuted.

> **Note:** When possible, avoid polling `muted` to monitor the track's muting status.
> Instead, add event listeners for the {{event("mute")}} and {{event("unmute")}} events.
> Instead, add event listeners for the {{domxref("MediaStreamTrack.mute_event", "mute")}} and {{domxref("MediaStreamTrack.unmute_event", "unmute")}} events.
## Examples

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/merchantvalidationevent/complete/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ browser-compat: api.MerchantValidationEvent.complete

The {{domxref("MerchantValidationEvent")}} method **`complete()`** takes merchant-specific information previously received from the {{domxref("MerchantValidationEvent.validationURL", "validationURL")}} and uses it to validate the merchant.

All you have to do is call `complete()` from your handler for the {{event("merchantvalidation")}} event, passing in the data fetched from the `validationURL`.
All you have to do is call `complete()` from your handler for the {{domxref("PaymentRequest.merchantvalidation_event", "merchantvalidation")}} event, passing in the data fetched from the `validationURL`.

## Syntax

Expand Down Expand Up @@ -59,7 +59,7 @@ function getValidationData(url) {
}
```

This code sets up a handler for the {{event("merchantvalidation")}} event. The event handler calls a function, `getValidationData()`, which retrieves the data from the validation URL, then passes that data (or a promise to deliver the data) into `complete()`.
This code sets up a handler for the {{domxref("PaymentRequest.merchantvalidation_event", "merchantvalidation")}} event. The event handler calls a function, `getValidationData()`, which retrieves the data from the validation URL, then passes that data (or a promise to deliver the data) into `complete()`.

## Browser compatibility

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/merchantvalidationevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To learn more about merchant validation, see {{SectionOnPage("/en-US/docs/Web/AP
## Constructor

- {{domxref("MerchantValidationEvent.MerchantValidationEvent()","MerchantValidationEvent()")}} {{securecontext_inline}}
- : Creates a new `MerchantValidationEvent` object describing a {{event("merchantvalidation")}} event that will be sent to the payment handler to request that it validate the merchant.
- : Creates a new `MerchantValidationEvent` object describing a {{domxref("PaymentRequest.merchantvalidation_event", "merchantvalidation")}} event that will be sent to the payment handler to request that it validate the merchant.

## Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ browser-compat: api.MerchantValidationEvent.MerchantValidationEvent
---
{{deprecated_header}}{{non-standard_header}}{{securecontext_header}}

The **`MerchantValidationEvent()`** constructor creates a new {{domxref("MerchantValidationEvent")}} object. You should not have to create these events yourself; instead, just handle the {{event("merchantvalidation")}} event.
The **`MerchantValidationEvent()`** constructor creates a new {{domxref("MerchantValidationEvent")}} object. You should not have to create these events yourself; instead, just handle the {{domxref("PaymentRequest.merchantvalidation_event", "merchantvalidation")}} event.

## Syntax

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/navigator/sendbeacon/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Like `beforeunload` and `unload`, this event is not reliably fired, especially o

## Examples

The following example specifies a handler for the {{event("visibilitychange")}} event. The handler calls `sendBeacon()` to send analytics.
The following example specifies a handler for the {{domxref("document.visibilitychange_event", "visibilitychange")}} event. The handler calls `sendBeacon()` to send analytics.

```js
document.addEventListener('visibilitychange', function logData() {
Expand Down
Loading

0 comments on commit ac7a7a7

Please sign in to comment.