feat: freeze data-* attribute API and add data-sync-ms (closes #23, closes #1)#27
Merged
Conversation
…loses #1) Stable public interface documented ahead of v1: - data-site-id, data-sync-url, data-room-id, data-relay-url, data-admin-id confirmed — no renames needed; names are consistent within type category (-url for URLs, -id for identifiers, -ms for ms) - data-sync-ms added: configurable server-sync poll interval (Mode 3 only); defaults to 30 000 ms; invalid values fall back with a console.warn Runtime enforcement: - Mutual exclusivity of data-sync-url and data-room-id now enforced: console.warn fires and initP2P() is suppressed when both are set (previously only a code comment, no runtime guard) Documentation: - README: new ## Script tag API section with stable 6-attribute reference table positioned after Quick start - CLAUDE.md: data-sync-ms row added to attribute table; Key Implementation Notes updated for _pollMs and the mutual-exclusivity guard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #23 — audit and freeze the
data-*attribute interface ahead of v1.Also closes #1 — configurable poll interval via
data-sync-ms.-urlfor URL values,-idfor identifier values) and ready to commit as a stable v1 interface.data-sync-msimplemented — configurable server sync poll interval (Mode 3 only); defaults to 30 000 ms; values ≤ 0 or non-numeric fall back to 30 s with aconsole.warn; replaces the hardcoded30000insetInterval.console.warnfires andinitP2P()is suppressed when bothdata-sync-urlanddata-room-idare set (if (_roomId && !_syncUrl)).## Script tag APIsection added to README — stable 6-attribute reference table with types, defaults, and the mutual-exclusivity note; positioned after Quick start for maximum discoverability.CLAUDE.mdupdated —data-sync-msrow in the attribute table; two new Key Implementation Notes for_pollMsand the mutual-exclusivity guard.Stable attribute table (as documented)
data-site-id"default"data-sync-urldata-room-iddata-relay-urldata-admin-iddata-sync-ms30000Test plan
demo.html(offline) — no console warningsdemo-sync-with-server.html— no warnings; polls every 30 sdata-sync-url+data-room-idset →console.warnfires, P2P not initializeddata-sync-ms="5000"→ polls every 5 s (verified via Network tab)data-sync-ms="bad"/"-1"/"0"→console.warnfires, falls back to 30 snpm run test:coverage→ 82 tests pass (server unchanged)npm run test:e2e→ 14/15 pass (1 pre-existing IDB flake; passes in isolation and covered by CIretries: 2)🤖 Generated with Claude Code