mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
[constants] refactor duplicate numeric constants
- Add `UI_FEEDBACK_DELAY_MS`, `DEBOUNCE_DELAY_MS`, and `NETWORK_RETRY_DELAY_MS` to `js/constants.js`. - Replace magic numbers (5000, 2000, 1500) with semantic constants in: - `js/ui/notificationController.js` - `js/ui/profileModal/ProfileDirectMessageActions.js` - `js/ui/urlHealthController.js` - `js/app/uiCoordinator.js` - `js/ui/components/VideoModal.js` - `js/ui/components/UploadModal.js` - `js/services/dmNostrService.js` - `js/services/hashtagPreferencesService.js` - `js/app/feedCoordinator.js` - `js/services/moderationService.js` Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
a090864bc2
commit
2aae4094e7
11 files changed
+35
-20
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { SHORT_TIMEOUT_MS } from "../constants.js";
|
||||
|
||||
export default class UrlHealthController {
|
||||
constructor({
|
||||
state = {},
|
||||
@@ -249,7 +251,7 @@ export default class UrlHealthController {
|
||||
}
|
||||
|
||||
async probeUrlWithVideoElement(url, timeoutMs) {
|
||||
const defaultTimeout = this.constants.URL_PROBE_TIMEOUT_MS || 5000;
|
||||
const defaultTimeout = this.constants.URL_PROBE_TIMEOUT_MS || SHORT_TIMEOUT_MS;
|
||||
const effectiveTimeout =
|
||||
Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : defaultTimeout;
|
||||
|
||||
@@ -346,7 +348,7 @@ export default class UrlHealthController {
|
||||
}
|
||||
|
||||
const confirmPlayable = options?.confirmPlayable === true;
|
||||
const defaultTimeout = this.constants.URL_PROBE_TIMEOUT_MS || 5000;
|
||||
const defaultTimeout = this.constants.URL_PROBE_TIMEOUT_MS || SHORT_TIMEOUT_MS;
|
||||
const urlHealthConstants = this.constants.urlHealthConstants || {};
|
||||
|
||||
const confirmWithVideoElement = async () => {
|
||||
|
||||
Reference in new issue
Block a user