@bosejs/runtime
v0.2.0
Published
The tiny resumable loader for Bose applications.
Maintainers
Readme
@bosejs/runtime
The tiny browser loader for Bosejs — resumes event handlers without hydration.
What it does
The runtime is the "heart" of Bosejs. It's a small (<2KB) script that runs in the browser and:
- Intercepts events via a single delegated listener on
document - Reads
bose:on:*attributes to find which chunk handles the event - Fetches the chunk lazily on first interaction (subsequent clicks use the cached module)
- Deserializes
bose:stateand injects it into the chunk as__BOSE_STATE__ - Executes the handler — the island "resumes" from exactly where the server left off
- Syncs signals — updates any DOM node with a matching
bose:bindattribute
Install
This package is installed automatically when you install @bosejs/core. You don't need to install it directly.
npm install @bosejs/core # pulls in @bosejs/runtime automaticallyHow resumption works
Your HTML looks like this after SSR:
<span bose:bind="count">0</span>
<button
bose:on:click="chunk_a1b2c3.js"
bose:state='{"count":0}'>
+
</button>On first click, the runtime:
- Fetches
chunk_a1b2c3.js(one network request, then cached) - Injects
{ count: signal(0) }as__BOSE_STATE__ - Runs the chunk (
count.value++) - Finds
<span bose:bind="count">and updates it to1
No framework boot. No virtual DOM. No re-render.
License
MIT © Bosejs Contributors
