Skip to content

Commit

Permalink
Rename private statesWithoutDialogClose field with underscore prefix (#…
Browse files Browse the repository at this point in the history
…1761)

Related #1120

This is non-functional change.

Notes

* Pattern matched: `this\.statesWithoutDialogClose(?=\W)`
    Replaced with: `this._statesWithoutDialogClose`
* Pattern matched: `(?<=\s)statesWithoutDialogClose =`
    Replaced with: `_statesWithoutDialogClose =`


<a data-ca-tag
href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1761"><img
src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review
on CodeApprove" /></a>
  • Loading branch information
jdeanwallace authored Mar 28, 2024
1 parent 515598f commit 22b3e8e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ Prefer to change a web component's appearance based on attributes and CSS rules
For a component that is used within an overlay, there might be certain states that should prevent the user from closing the dialog. That’s typically the case when we are waiting for an action to complete (for example when loading something).
These particular states are listed in the `statesWithoutDialogClose` class property, like so:
These particular states are listed in the `_statesWithoutDialogClose` class property, like so:
```javascript
class extends HTMLElement {
Expand All @@ -393,7 +393,7 @@ class extends HTMLElement {
FETCH_FROM_URL: "fetch-from-url",
VIEW: "view",
};
statesWithoutDialogClose = new Set([this._states.INITIALIZING]);
_statesWithoutDialogClose = new Set([this._states.INITIALIZING]);
```
Note: for consistency, we always use a `Set` here, even if it only contains a single element.
Expand All @@ -405,7 +405,7 @@ set _state(newValue) {
this.setAttribute("state", newValue);
this.dispatchEvent(
new DialogCloseStateChangedEvent(
!this.statesWithoutDialogClose.has(newValue)
!this._statesWithoutDialogClose.has(newValue)
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/custom-elements/change-hostname-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h3>Changing Hostname</h3>
PROMPT: "prompt",
CHANGING: "changing",
};
statesWithoutDialogClose = new Set([
_statesWithoutDialogClose = new Set([
this._states.CHANGING,
this._states.INITIALIZING,
]);
Expand Down Expand Up @@ -150,7 +150,7 @@ <h3>Changing Hostname</h3>
this.setAttribute("state", newValue);
this.dispatchEvent(
new DialogCloseStateChangedEvent(
!this.statesWithoutDialogClose.has(newValue)
!this._statesWithoutDialogClose.has(newValue)
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/custom-elements/debug-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h3>Debug Logs</h3>
LOGS_LOADING: "logs-loading",
LOGS_SUCCESS: "logs-success",
};
statesWithoutDialogClose = new Set([this._states.LOGS_LOADING]);
_statesWithoutDialogClose = new Set([this._states.LOGS_LOADING]);

constructor() {
super();
Expand Down Expand Up @@ -129,7 +129,7 @@ <h3>Debug Logs</h3>
this.setAttribute("state", newValue);
this.dispatchEvent(
new DialogCloseStateChangedEvent(
!this.statesWithoutDialogClose.has(newValue)
!this._statesWithoutDialogClose.has(newValue)
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/custom-elements/shutdown-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h3>Shutdown Complete</h3>
SHUTTING_DOWN: "shutting-down",
SHUTDOWN_COMPLETE: "shutdown-complete",
};
statesWithoutDialogClose = new Set([
_statesWithoutDialogClose = new Set([
this._states.RESTARTING,
this._states.SHUTTING_DOWN,
this._states.SHUTDOWN_COMPLETE,
Expand Down Expand Up @@ -118,7 +118,7 @@ <h3>Shutdown Complete</h3>
this.setAttribute("state", newValue);
this.dispatchEvent(
new DialogCloseStateChangedEvent(
!this.statesWithoutDialogClose.has(newValue)
!this._statesWithoutDialogClose.has(newValue)
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/custom-elements/update-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h3>Update Complete</h3>
RESTARTING: "restarting",
UPDATE_FINISHED: "update-finished",
};
statesWithoutDialogClose = new Set([
_statesWithoutDialogClose = new Set([
this._states.CHECKING,
this._states.UPDATING,
this._states.RESTARTING,
Expand Down Expand Up @@ -195,7 +195,7 @@ <h3>Update Complete</h3>
this.setAttribute("state", newValue);
this.dispatchEvent(
new DialogCloseStateChangedEvent(
!this.statesWithoutDialogClose.has(newValue)
!this._statesWithoutDialogClose.has(newValue)
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/custom-elements/video-settings-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ <h3>Applying Video Settings</h3>
EDIT: "edit",
SAVING: "saving",
};
statesWithoutDialogClose = new Set([
_statesWithoutDialogClose = new Set([
this._states.LOADING,
this._states.SAVING,
]);
Expand Down Expand Up @@ -358,7 +358,7 @@ <h3>Applying Video Settings</h3>
this.setAttribute("state", newValue);
this.dispatchEvent(
new DialogCloseStateChangedEvent(
!this.statesWithoutDialogClose.has(newValue)
!this._statesWithoutDialogClose.has(newValue)
)
);
}
Expand Down

0 comments on commit 22b3e8e

Please sign in to comment.