framerock/README.md

50 lines
1.5 KiB
Markdown

# framerock
## getting started
Install:
```bash
bun add 'git+https://git.daemons.my/dab/framerock.git'
```
Create `your-app-entrypoint.js`:
```js
import { async_run } from 'framerock'
await async_run({
jsbuild_app_frontend: async function () {return `
FRAMEROCK_UTILS.setup_transport({
on_open: () => FRAMEROCK_UTILS.transport_send_bytes(new TextEncoder().encode('Hello from client!')),
on_message: (event) => document.body.appendChild(document.createTextNode('Client received message: ' + new TextDecoder().decode(event.data)))
})
`},
handle_transport_bytes: function (message, { client_id, transport_send_bytes }) {
console.log(['Server received message:', client_id, new TextDecoder().decode(message)])
transport_send_bytes(new TextEncoder().encode('Hello from server!'))
}
})
```
Run server:
```bash
bun run your-app-entrypoint.js
```
## changelog
- **Version 1.1.0**
- added `func_register_teardown`, made `jsbuild_app_frontend` optional
- **Version 1.0.1**
- added `handle_fetch_fallback`
- **Version 1.0.0**
- `page_title` now defaults to "framerock app"
- `client_id` now available inside `handle_transport_bytes` (added property to `utils` object)
- ⚠️ **BACKWARD-INCOMPATIBLE CHANGES** ⚠️
- `handle_transport_bytes` moved `utils` to be the final argument in function call (can be optionally consumed now)
## built with framerock
- [theatrics](https://git.daemons.my/dab/theatrics), *JS Actor System with first-class support for AI Agents and Assistants*