You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normalize ConnectionThresholds field names + remove disableAutoplay (#33)
* Remove disableAutoplay rendering hint
Redundant with deferHeavyComponents — both triggered on identical
conditions (isLowEnd || isSlowConnection || isBatteryConstrained).
* Normalize ConnectionThresholds field names
Rename downlink2gUpperBound/downlink3gUpperBound/downlink4gUpperBound
to lowUpperBound/midUpperBound/highUpperBound, matching the pattern
used by CpuThresholds and MemoryThresholds.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,12 @@
4
4
5
5
### Breaking Changes
6
6
7
+
-**Normalize `ConnectionThresholds` field names** — Renamed `downlink2gUpperBound` → `lowUpperBound`, `downlink3gUpperBound` → `midUpperBound`, `downlink4gUpperBound` → `highUpperBound` to match the `CpuThresholds`/`MemoryThresholds` naming pattern. Update any custom `connection` threshold objects in your `thresholds` config
7
8
-**Rename `ConnectionTier` value `'fast'` → `'high'`** — Aligns connection tier vocabulary with CPU, memory, and GPU tiers which all use `'low' | 'mid' | 'high'`. Update any code comparing `tiers.connection === 'fast'` to use `'high'` instead
8
9
-**`classify()` and `deriveHints()` now accept `StoredSignals` instead of `RawSignals`** — These functions never used `userAgent` or `viewport` (which are stripped before storage). The narrower type makes the API honest. Existing call sites are unaffected — `RawSignals` is structurally assignable to `StoredSignals`
9
10
-**`profile:store` event now carries `StoredSignals` instead of `RawSignals`** — The event previously emitted the raw probe payload (including `userAgent`/`viewport`), not what was actually stored. The `signals` field now matches the persisted data. `bot:reject` still carries `RawSignals` (it fires before stripping)
10
11
-**Rename default cookie `dr_session` → `device-router-session`** — Self-documenting name before 1.0 locks the cookie in. If you hardcode `cookieName: 'dr_session'` in your options you are unaffected; if you rely on the default, existing sessions will reset once on deploy
12
+
-**Remove `disableAutoplay` rendering hint** — `disableAutoplay` triggered on identical conditions to `deferHeavyComponents` (`isLowEnd || isSlowConnection || isBatteryConstrained`). Use `deferHeavyComponents` instead
11
13
-**middleware-fastify: normalized return shape** — `createDeviceRouter()` now returns raw Fastify hooks instead of a `fastify-plugin` wrapped plugin. Migrate `await app.register(middleware)` → `app.addHook('preHandler', middleware)`. When using `injectProbe: true`, register the injection hook separately: `app.addHook('onSend', injectionMiddleware)`. Removed `fastify-plugin` dependency
-**Battery API signal** — Collect battery level and charging status via `navigator.getBattery()` (Chromium-only, silently skipped elsewhere). When unplugged and below 15%, `deferHeavyComponents`, `reduceAnimations`, and `disableAutoplay` are forced on
65
+
-**Battery API signal** — Collect battery level and charging status via `navigator.getBattery()` (Chromium-only, silently skipped elsewhere). When unplugged and below 15%, `deferHeavyComponents`and `reduceAnimations` are forced on
64
66
-**Signal validation** — New `isValidSignals()` type guard for validating incoming probe payloads
65
67
-**Custom GPU thresholds** — `softwarePattern` and `highEndPattern` are configurable via `GpuThresholds`
Copy file name to clipboardExpand all lines: README.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ A **~1 KB** client probe. One middleware call. Full device awareness on every re
18
18
Responsive design adapts layout. DeviceRouter adapts **what you serve**.
19
19
20
20
- A budget phone on 2G? Skip the heavy animations, defer non-critical components, prefer server-side rendering.
21
-
- A flagship on fiber? Go all out — autoplay, full interactivity, rich visuals.
21
+
- A flagship on fiber? Go all out — full interactivity, rich visuals.
22
22
23
23
No user-agent sniffing. No guesswork. Real signals from real devices, classified into actionable tiers and rendering hints your server can act on immediately.
24
24
@@ -120,7 +120,6 @@ Based on tiers and user preferences, DeviceRouter derives actionable booleans:
120
120
|`serveMinimalCSS`| Low-end device |
121
121
|`reduceAnimations`| Low-end device, prefers reduced motion, or low battery |
Copy file name to clipboardExpand all lines: docs/api/types.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ const tiers = classify({
21
21
22
22
Derives rendering hints from device tiers.
23
23
24
-
The `battery` signal bypasses tier classification entirely — it's transient state, not a capability. When the device is unplugged and below 15% charge, `deferHeavyComponents`, `reduceAnimations`, and `disableAutoplay` are forced on to conserve power.
24
+
The `battery` signal bypasses tier classification entirely — it's transient state, not a capability. When the device is unplugged and below 15% charge, `deferHeavyComponents`and `reduceAnimations` are forced on to conserve power.
0 commit comments