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

Use arrow functions for anonymous functions where possible (part #8) #19191

Merged
merged 71 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d6c2feb
Use arrow functions
teoli2003 Aug 5, 2022
f69495e
const
teoli2003 Aug 5, 2022
4c7631f
Spaces
teoli2003 Aug 5, 2022
c2573a0
Spaces
teoli2003 Aug 5, 2022
1640e2a
Spaces
teoli2003 Aug 6, 2022
7242195
spaces
teoli2003 Aug 6, 2022
252c76e
spaces
teoli2003 Aug 6, 2022
c6ea8c5
Space
teoli2003 Aug 6, 2022
1a1baed
Add comment
teoli2003 Aug 6, 2022
fbfc897
spaces
teoli2003 Aug 6, 2022
eafc358
syntax + comments
teoli2003 Aug 6, 2022
7e70fb8
indent
teoli2003 Aug 6, 2022
4c04771
indent + this
teoli2003 Aug 6, 2022
179f015
indent + this
teoli2003 Aug 6, 2022
cd75579
const + for...of
teoli2003 Aug 7, 2022
987180a
Revert to innerHTML
teoli2003 Aug 7, 2022
623b1f7
clean
teoli2003 Aug 7, 2022
f96a314
remove Hungarian notation + indent
teoli2003 Aug 7, 2022
26f3cc1
let -> const
teoli2003 Aug 7, 2022
4ae4dc3
Indent
teoli2003 Aug 7, 2022
763daa7
fix indent
teoli2003 Aug 7, 2022
64e72ee
shorten string
teoli2003 Aug 7, 2022
ca6aa10
indent
teoli2003 Aug 7, 2022
3da94ad
indent
teoli2003 Aug 7, 2022
57eb4c8
Fix indent
teoli2003 Aug 7, 2022
daddf69
Fix indent
teoli2003 Aug 7, 2022
5a88ef7
Fix indent
teoli2003 Aug 7, 2022
3cd9391
Fix indent
teoli2003 Aug 7, 2022
db27615
Fix indent
teoli2003 Aug 7, 2022
64c2248
Fix indent
teoli2003 Aug 7, 2022
5269ca1
Fix indent
teoli2003 Aug 7, 2022
3a9a13c
Fix indent
teoli2003 Aug 7, 2022
f1a3af6
Fix indent
teoli2003 Aug 7, 2022
c98915f
Fix indent + template strings
teoli2003 Aug 7, 2022
6d9040b
Fix indent
teoli2003 Aug 7, 2022
35aad23
Fix indent
teoli2003 Aug 7, 2022
a18562e
Fix indent
teoli2003 Aug 7, 2022
960fe47
indent - Hungarian notation
teoli2003 Aug 7, 2022
c3788ea
Fix indentation
teoli2003 Aug 7, 2022
b152a97
Fix spaces
teoli2003 Aug 7, 2022
e4929cc
Merge branch 'main' into function-arrow-8
teoli2003 Aug 7, 2022
0036c4c
Update index.md
Josh-Cena Aug 8, 2022
2451ffb
Update files/en-us/web/api/web_audio_api/simple_synth/index.md
teoli2003 Aug 8, 2022
6dc5677
Update files/en-us/web/api/web_audio_api/simple_synth/index.md
teoli2003 Aug 8, 2022
7f952fa
Update files/en-us/web/api/web_audio_api/simple_synth/index.md
teoli2003 Aug 8, 2022
d3b0b02
Update files/en-us/web/api/web_audio_api/using_iir_filters/index.md
teoli2003 Aug 8, 2022
f477f6a
Update files/en-us/web/api/web_audio_api/using_iir_filters/index.md
teoli2003 Aug 8, 2022
b380526
Update files/en-us/web/api/web_audio_api/web_audio_spatialization_bas…
teoli2003 Aug 8, 2022
4301976
Update index.md
Josh-Cena Aug 8, 2022
db83d50
Update files/en-us/web/api/web_workers_api/using_web_workers/index.md
teoli2003 Aug 8, 2022
2242bcf
Update files/en-us/web/api/web_speech_api/using_the_web_speech_api/in…
teoli2003 Aug 8, 2022
a36d7ec
Update files/en-us/web/api/web_workers_api/using_web_workers/index.md
teoli2003 Aug 8, 2022
746c7a5
Update files/en-us/web/api/web_workers_api/using_web_workers/index.md
teoli2003 Aug 8, 2022
eb59aec
Update files/en-us/web/api/web_workers_api/using_web_workers/index.md
teoli2003 Aug 8, 2022
0d9bf64
Update files/en-us/web/api/webgl_api/by_example/hello_glsl/index.md
teoli2003 Aug 8, 2022
fb28b19
Update files/en-us/web/api/websockets_api/writing_websocket_server/in…
teoli2003 Aug 8, 2022
1c62be5
Revert over-correction
teoli2003 Aug 8, 2022
ce1e09e
Update files/en-us/web/api/webrtc_api/signaling_and_video_calling/ind…
teoli2003 Aug 8, 2022
06c23e9
Remove extraneous brace
teoli2003 Aug 8, 2022
586c548
Update files/en-us/web/api/webrtc_api/signaling_and_video_calling/ind…
teoli2003 Aug 8, 2022
c5cf8f4
Update files/en-us/web/api/webrtc_api/signaling_and_video_calling/ind…
teoli2003 Aug 8, 2022
430ae85
small improvement
teoli2003 Aug 8, 2022
51848c1
Update files/en-us/web/api/window/location/index.md
teoli2003 Aug 8, 2022
7c3bb37
Remove Hungarian left-over
teoli2003 Aug 8, 2022
46428c9
Update files/en-us/web/api/window/location/index.md
teoli2003 Aug 8, 2022
a291bb6
Fix logs
teoli2003 Aug 8, 2022
a2740af
Merge branch 'main' into function-arrow-8
teoli2003 Aug 8, 2022
565680a
add parentheses
teoli2003 Aug 8, 2022
73cf3d0
Update index.md
Josh-Cena Aug 8, 2022
f3333eb
Update index.md
Josh-Cena Aug 8, 2022
efe3edb
Changes
Josh-Cena Aug 8, 2022
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
2 changes: 1 addition & 1 deletion files/en-us/web/api/touch/pagey/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ are accessed via the event's {{domxref("TouchEvent.changedTouches")}} list.
// Register a touchmove listeners for the 'source' element
const src = document.getElementById("source");

src.addEventListener('touchmove', function(e) {
src.addEventListener('touchmove', (e) => {
// Iterate through the touch points that have moved and log each
// of the pageX/Y coordinates. The unit of each coordinate is CSS pixels.
for (let i = 0; i < e.changedTouches.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/touch/screenx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In following simple code snippet, we assume the user initiates multiple touch co
// Register a touchstart listeners for the 'source' element
const src = document.getElementById("source");

src.addEventListener('touchstart', function(e) {
src.addEventListener('touchstart', (e) => {
// Iterate through the touch points and log each screenX/Y coordinate.
// The unit of each coordinate is CSS pixels.
for (let i = 0; i < e.touches.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/touch/target/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ In following simple code snippet, we assume the user initiates one or more touch
// Register a touchmove listener for the 'source' element
const src = document.getElementById("source");

src.addEventListener('touchstart', function(e) {
src.addEventListener('touchstart', (e) => {
// Iterate through the touch points that were activated
// for this element.
for (let i = 0; i < e.targetTouches.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Access the attributes of a touch point.

```js
// Create touchstart handler
someElement.addEventListener('touchstart', function(ev) {
someElement.addEventListener('touchstart', (ev) => {
// Iterate through the touch points that were activated
// for this element and process each event 'target'
for (let i = 0; i < ev.targetTouches.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/touchevent/altkey/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This example illustrates how to access the {{domxref("TouchEvent")}} key modifie
In following code snippet, the {{domxref("Element/touchstart_event", "touchstart")}} event handler logs the state of the event's modifier keys.

```js
someElement.addEventListener('touchstart', function(e) {
someElement.addEventListener('touchstart', (e) => {
// Log the state of this event's modifier keys
console.log(`altKey = ${e.altKey}`);
console.log(`ctrlKey = ${e.ctrlKey}`);
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/touchevent/changedtouches/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This example illustrates the {{domxref("TouchEvent")}} object's {{domxref("Touch
In following code snippet, the {{domxref("Element/touchmove_event", "touchmove")}} event handler iterates through the `changedTouches` list and prints the identifier of each touch point that changed since the last event.

```js
someElement.addEventListener('touchmove', function(e) {
someElement.addEventListener('touchmove', (e) => {
// Iterate through the list of touch points that changed
// since the last event and print each touch point's identifier.
for (let i = 0; i < e.changedTouches.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/touchevent/touches/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ that were activated and then invokes different handlers depending on the number
points.

```js
someElement.addEventListener('touchstart', function(e) {
someElement.addEventListener('touchstart', (e) => {
// Invoke the appropriate handler depending on the
// number of touch points.
switch (e.touches.length) {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/touchlist/item/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This code example illustrates the use of the {{domxref("TouchList")}} interface'
```js
const target = document.getElementById("target");

target.addEventListener('touchstart', function(ev) {
target.addEventListener('touchstart', (ev) => {

// If this touchstart event started on element target,
// set touch to the first item in the targetTouches list;
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/touchlist/length/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This code example illustrates the use of the {{domxref("TouchList")}} interface'
```js
const target = document.getElementById("target");

target.addEventListener('touchstart', function(ev) {
target.addEventListener('touchstart', (ev) => {

// If this touchstart event started on element target,
// set touch to the first item in the targetTouches list;
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/userproximityevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The **`UserProximityEvent`** indicates whether a nearby physical object is prese
## Examples

```js
window.addEventListener('userproximity', function(event) {
window.addEventListener('userproximity', (event) => {
if (event.near) {
// let's power off the screen
navigator.mozPower.screenEnabled = false;
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vibration_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function stopVibrate() {
// Start persistent vibration at given duration and interval
// Assumes a number value is given
function startPersistentVibrate(duration, interval) {
vibrateInterval = setInterval(function() {
vibrateInterval = setInterval(() => {
startVibrate(duration);
}, interval);
}
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/videotrack/label/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ only allow certain track kinds through.

```js
function getTrackList(el) {
let trackList = [];
cons trackList = [];
const wantedKinds = [
"main", "alternative", "commentary"
];

el.videoTracks.forEach(function(track) {
el.videoTracks.forEach((track) => {
if (wantedKinds.includes(track.kind)) {
trackList.push({
id: track.id,
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/visualviewport/resize_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ A generic {{domxref("Event")}}.
You can use the `resize` event in an [`addEventListener`](/en-US/docs/Web/API/EventTarget/addEventListener) method:

```js
visualViewport.addEventListener('resize', function() {
visualViewport.addEventListener('resize', () => {
// …
});
```

Or use the `onresize` event handler property:

```js
visualViewport.onresize = function() {
visualViewport.onresize = () => {
// …
};
```
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/visualviewport/scroll_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ A generic {{domxref("Event")}}.
You can use the `scroll` event in an [`addEventListener`](/en-US/docs/Web/API/EventTarget/addEventListener) method:

```js
visualViewport.addEventListener('scroll', function() {
visualViewport.addEventListener('scroll', () => {
// …
});
```

Or use the `onscroll` event handler property:

```js
visualViewport.onscroll = function() {
visualViewport.onscroll = () => {
// …
};
```
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/vrdisplay/cancelanimationframe/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ drawScene();
if(navigator.getVRDisplays) {
console.log('WebVR 1.1 supported');
// Then get the displays attached to the computer
navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
// If a display is available, use it to present the scene
if(displays.length > 0) {
vrDisplay = displays[0];
console.log('Display found');
// Starting the presentation when the button is clicked: It can only be called in response to a user gesture
btn.addEventListener('click', function() {
btn.addEventListener('click', () => {
if(btn.textContent === 'Start VR display') {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
vrDisplay.requestPresent([{ source: canvas }]).then(() => {
console.log('Presenting to WebVR display');

// Set the canvas size to the size of the vrDisplay viewport
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vrdisplay/depthfar/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ It initial value is `10000.0`.
```js
let vrDisplay;

navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
vrDisplay = displays[0];
vrDisplay.depthNear = 1.0;
vrDisplay.depthFar = 7500.0;
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vrdisplay/depthnear/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ A double, representing the z-depth in meters; its initial value is `0.01`.
```js
let vrDisplay;

navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
vrDisplay = displays[0];
vrDisplay.depthNear = 1.0;
vrDisplay.depthFar = 7500.0;
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/vrdisplay/exitpresent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ A promise that resolves once the presentation has ended. If the `VRDisplay` is n
if(navigator.getVRDisplays) {
console.log('WebVR 1.1 supported');
// Then get the displays attached to the computer
navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
// If a display is available, use it to present the scene
if(displays.length > 0) {
vrDisplay = displays[0];
console.log('Display found');
// Starting the presentation when the button is clicked: It can only be called in response to a user gesture
btn.addEventListener('click', function() {
btn.addEventListener('click', () => {
if(btn.textContent === 'Start VR display') {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
vrDisplay.requestPresent([{ source: canvas }]).then(() => {
console.log('Presenting to WebVR display');

// Set the canvas size to the size of the vrDisplay viewport
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/vrdisplay/getframedata/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ A boolean value — a value of `true` is returned if the {{domxref("VRFrameData"
const frameData = new VRFrameData();
let vrDisplay;

navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
vrDisplay = displays[0];
console.log('Display found');
// Starting the presentation when the button is clicked: It can only be called in response to a user gesture
btn.addEventListener('click', function() {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
btn.addEventListener('click', () => {
vrDisplay.requestPresent([{ source: canvas }]).then(() => {
drawVRScene();
});
});
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/vrdisplay/getpose/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ A {{domxref("VRPose")}} object.
Once we have a reference to a {{domxref("VRDisplay")}} object, we can retrieve the {{domxref("VRPose")}} representing the current pose of the display.

```js
if(navigator.getVRDisplays) {
if (navigator.getVRDisplays) {
console.log('WebVR 1.1 supported');
// Then get the displays attached to the computer
navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
// If a display is available, use it to present the scene
if(displays.length > 0) {
if (displays.length > 0) {
vrDisplay = displays[0];
console.log('Display found');

Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/vrdisplay/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ An array of all connected VR Devices can be returned by invoking the {{domxref("
## Examples

```js
if(navigator.getVRDisplays) {
if (navigator.getVRDisplays) {
console.log('WebVR 1.1 supported');
// Then get the displays attached to the computer
navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
// If a display is available, use it to present the scene
if(displays.length > 0) {
if (displays.length > 0) {
vrDisplay = displays[0];
// Now we have our VRDisplay object and can do what we want with it
}
Expand Down
10 changes: 5 additions & 5 deletions files/en-us/web/api/vrdisplay/isconnected/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ A boolean value; `true` means the display is connected; `false` means it isn't.
## Examples

```js
navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
// If a display is available, use it to present the scene
if(displays.length > 0) {
if (displays.length > 0) {
vrDisplay = displays[0];

// Starting the presentation when the button is clicked: It can only be called in response to a user gesture
btn.addEventListener('click', function() {
btn.addEventListener('click', () => {
// Only request presentation if the display is still connected.
if(vrDisplay.isConnected) {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
if (vrDisplay.isConnected) {
vrDisplay.requestPresent([{ source: canvas }]).then(() => {
// start rendering the app, etc.
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/vrdisplay/ispresenting/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function onVRExitPresent () {
// we weren't presenting.)
if (!vrDisplay.isPresenting)
return;
vrDisplay.exitPresent().then(function () {
vrDisplay.exitPresent().then(() => {
// Nothing to do because we're handling things in onVRPresentChange.
}, function (err) {
}, (err) => {
let errMsg = "exitPresent failed.";
if (err && err.message) {
errMsg += `<br/>${err.message}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ A long representing the handle of the `requestAnimationFrame()` call. This can t
const frameData = new VRFrameData();
let vrDisplay;

navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
vrDisplay = displays[0];
console.log('Display found');
// Starting the presentation when the button is clicked: It can only be called in response to a user gesture
btn.addEventListener('click', function() {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
btn.addEventListener('click', () => {
vrDisplay.requestPresent([{ source: canvas }]).then(() => {
drawVRScene();
});
});
Expand Down
12 changes: 6 additions & 6 deletions files/en-us/web/api/vrdisplay/requestpresent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ A promise that resolves once the presentation has begun. there are a number of r
## Examples

```js
if(navigator.getVRDisplays) {
if (navigator.getVRDisplays) {
console.log('WebVR 1.1 supported');
// Then get the displays attached to the computer
navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
// If a display is available, use it to present the scene
if(displays.length > 0) {
if (displays.length > 0) {
vrDisplay = displays[0];
console.log('Display found');
// Starting the presentation when the button is clicked: It can only be called in response to a user gesture
btn.addEventListener('click', function() {
if(btn.textContent === 'Start VR display') {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
btn.addEventListener('click', () => {
if (btn.textContent === 'Start VR display') {
vrDisplay.requestPresent([{ source: canvas }]).then(() => {
console.log('Presenting to WebVR display');

// Set the canvas size to the size of the vrDisplay viewport
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vrdisplay/resetpose/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ None ({{jsxref("undefined")}}).
```js
// Assuming vrDisplay already contains a VRDisplay object,
// and we have a <button> referenced inside btn
btn.addEventListener('click', function() {
btn.addEventListener('click', () => {
vrDisplay.resetPose();
console.log('Current pose set as origin/center');
});
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/vrdisplay/submitframe/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ None ({{jsxref("undefined")}}).
const frameData = new VRFrameData();
let vrDisplay;

navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
vrDisplay = displays[0];
console.log('Display found');
// Starting the presentation when the button is clicked: It can only be called in response to a user gesture
btn.addEventListener('click', function() {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
btn.addEventListener('click', () => {
vrDisplay.requestPresent([{ source: canvas }]).then(() => {
drawVRScene();
});
});
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vrdisplaycapabilities/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This interface is accessible through the {{domxref("VRDisplay.capabilities")}} p

```js
function reportDisplays() {
navigator.getVRDisplays().then(function(displays) {
navigator.getVRDisplays().then((displays) => {
for (let i = 0; i < displays.length; i++) {
const cap = displays[i].capabilities;
// cap is a VRDisplayCapabilities object
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vrdisplayevent/display/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ A {{domxref("VRDisplay")}} object.
## Examples

```js
window.addEventListener('vrdisplaypresentchange', function(e) {
window.addEventListener('vrdisplaypresentchange', (e) => {
console.log(`Display ${e.display.displayId} presentation has changed. Reason given: ${e.reason}.`);
})
```
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vrdisplayevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _`VRDisplayEvent` also inherits properties from its parent object, {{domxref("Ev
## Examples

```js
window.addEventListener('vrdisplaypresentchange', function(e) {
window.addEventListener('vrdisplaypresentchange', (e) => {
console.log(`Display ${e.display.displayId} presentation has changed. Reason given: ${e.reason}.`);
})
```
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/vrdisplayevent/reason/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ A string representing the reason why the event was fired. The available reasons
## Examples

```js
window.addEventListener('vrdisplaypresentchange', function(e) {
window.addEventListener('vrdisplaypresentchange', (e) => {
console.log(`Display ${e.display.displayId} presentation has changed. Reason given: ${e.reason}.`);
})
```
Expand Down
Loading