JS framework for rad web apps
Find a file
2025-08-15 18:29:50 +00:00
backend better error handling (now wrapping user-defined functions with try/catch), better frontend logging (debug replaces info) 2025-08-15 14:40:27 +00:00
frontend standardized transport API on frontend (added on_error hook, on_message now receives full event) 2025-08-15 18:29:50 +00:00
package.json added explicit encode/decode to example, added type=module to package.json 2025-08-15 15:35:27 +00:00
README.md standardized transport API on frontend (added on_error hook, on_message now receives full event) 2025-08-15 18:29:50 +00:00

framerock

JS framework for rad web apps

a minimal example:

import { async_run } from 'framerock'

const jsbuild_app_frontend = async function () {
	return `
const on_open = function () {
	FRAMEROCK_UTILS.transport_send_bytes(new TextEncoder().encode('Hello from client!'))
	return
}
const on_message = function (event) {
	console.log(['Client received message:', new TextDecoder().decode(event.data)])
	return
}
FRAMEROCK_UTILS.setup_transport({ on_open, on_message })
`.trim()
}

const handle_transport_bytes = function (utils, message) {
	console.log(['Server received message:', new TextDecoder().decode(message)])
	utils.transport_send_bytes(new TextEncoder().encode('Hello from server!'))
	return
}

const config = {
	hostname: '0.0.0.0',
	port: 8800,
	page_title: 'framerock demo',
}

async_run({ config, jsbuild_app_frontend, handle_transport_bytes }).then(()=>{}).catch(console.error)