refactor: extract magic constants — wave 3 (font lifecycle)
Promote font-loading scheduling and lifecycle tunables to named module-level constants: - comparisonStore: FONT_READY_FALLBACK_MS (1000ms) — UI unblock safety net - fontLifecycleManager: - PURGE_INTERVAL_MS (60000) — periodic eviction sweep - IDLE_CALLBACK_TIMEOUT_MS (150) — requestIdleCallback timeout - SCHEDULE_FALLBACK_MS (16) — setTimeout fallback (~60fps) - YIELD_INTERVAL_MS (8) — parse-loop yield budget for non-Chromium - CRITICAL_FONT_WEIGHTS ([400, 700]) — data-saver allowlist - FontEvictionPolicy: DEFAULT_FONT_TTL_MS (5 minutes) - FontLoadQueue: FONT_LOAD_MAX_RETRIES (3) No behavior changes — values preserved exactly. Class-private fields that mirrored these constants are removed in favor of module scope.
This commit is contained in:
+7
-2
@@ -1,6 +1,11 @@
|
||||
/**
|
||||
* Default TTL after which an unpinned font is eligible for eviction.
|
||||
*/
|
||||
export const DEFAULT_FONT_TTL_MS = 5 * 60 * 1000;
|
||||
|
||||
interface FontEvictionPolicyOptions {
|
||||
/**
|
||||
* TTL in milliseconds. Defaults to 5 minutes.
|
||||
* TTL in milliseconds. Defaults to {@link DEFAULT_FONT_TTL_MS}.
|
||||
*/
|
||||
ttl?: number;
|
||||
}
|
||||
@@ -17,7 +22,7 @@ export class FontEvictionPolicy {
|
||||
|
||||
readonly #TTL: number;
|
||||
|
||||
constructor({ ttl = 5 * 60 * 1000 }: FontEvictionPolicyOptions = {}) {
|
||||
constructor({ ttl = DEFAULT_FONT_TTL_MS }: FontEvictionPolicyOptions = {}) {
|
||||
this.#TTL = ttl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user