Skip to content

Add strict browser wrappers for window timers and navigator share#33

Merged
sbsoftware merged 11 commits intoreleases/v1.8.0from
feature/JS-47
Feb 19, 2026
Merged

Add strict browser wrappers for window timers and navigator share#33
sbsoftware merged 11 commits intoreleases/v1.8.0from
feature/JS-47

Conversation

@sbsoftware-agent
Copy link
Collaborator

Summary

Adds typed browser context wrappers for window timers and navigator.share so strict-mode snippets can use real browser globals without _literal_js.

Changes

  • Added JS::Context::Window with:
  • setTimeout(callback, delay) returning a typed JS::Context::TimerHandle
  • clearTimeout(handle) accepting that typed handle
  • Added JS::Context::Navigator#share with typed named args:
  • required text
  • optional title and url
  • Added JS::Context::ShareData to emit the share payload object literal.
  • Exposed new strict entrypoints via JS::Context::Browser:
  • window
  • navigator
  • Added specs covering:
  • strict-mode timer snippet emission (window.setTimeout + window.clearTimeout)
  • strict-mode share snippet emission (navigator.share)
  • typed wrapper return behavior and to_js_ref output
  • Updated README browser-wrapper docs to include the new APIs and example usage.

Testing

  • CRYSTAL_CACHE_DIR=/tmp/.crystal-cache-js crystal spec
  • Result: 53 examples, 0 failures, 0 errors, 0 pending

@sbsoftware sbsoftware merged commit c4d257b into releases/v1.8.0 Feb 19, 2026
@sbsoftware sbsoftware deleted the feature/JS-47 branch February 19, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants