🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

frameos-wasm

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frameos-wasm

Run FrameOS scenes in the browser via WebAssembly: a typed live-preview runtime plus a minimal showIf-aware management interface.

latest
Source
npmnpm
Version
2026.7.6
Version published
Weekly downloads
134
Maintainers
1
Weekly downloads
 
Created
Source

frameos-wasm

Run FrameOS scenes in the browser through WebAssembly. The package wraps the emscripten-built FrameOS scene runtime with a typed API and ships a minimal management interface: a live canvas, scene switching, showIf-aware state fields, event buttons, and logs — the same control surface a frame exposes on-device.

The package version always equals the FrameOS release the runtime was built from.

Install

npm install frameos-wasm

The runtime assets (frameos.js, frameos.wasm, preview-worker.js) live in frameos-wasm/dist/assets/. They must be served same-origin (the runtime runs in a module Web Worker and uses synchronous XHR): copy that directory into your static assets, e.g. to /frameos-wasm/.

Quick start — management interface

import { mountFrameOSManager } from 'frameos-wasm'

const handle = mountFrameOSManager(document.getElementById('preview')!, {
  workerUrl: '/frameos-wasm/preview-worker.js',
  width: 800,
  height: 480,
  scenes, // parsed scenes.json (from a template zip, backup, or export)
})
// later: handle.preview.sendEvent('myButton'), handle.destroy()

Lower level — just the runtime

import { createFrameOSPreview } from 'frameos-wasm'

const preview = createFrameOSPreview({
  workerUrl: '/frameos-wasm/preview-worker.js',
  width: 800,
  height: 480,
  scenes,
  canvas: document.querySelector('canvas'),
  onLog: (line) => console.log(line),
  onState: (state) => console.log('scene state', state),
})
preview.setSceneState({ message: 'Hello' })
preview.sendEvent('button', { label: 'a' })
preview.selectScene('sceneId')
preview.destroy()

Helpers for building your own UI are exported too: evaluateShowIf, visiblePublicStateFields, coerceStateFieldValue, sceneEventButtons, and the StateField/FrameOSScene types.

Notes

  • Scenes that fetch external URLs are subject to browser CORS unless you pass proxyUrl (a same-origin endpoint that forwards {method, url, headers, bodyBase64, timeoutMs} — see FrameOS's /api/frames/{id}/scene_preview_proxy).
  • Apps that need host processes are not in the wasm build: data/chromiumScreenshot, data/rstpSnapshot, data/localImage.
  • index.html in the package root is a standalone demo page: npx serve node_modules/frameos-wasm and paste a scenes.json.

Development (FrameOS repo)

The runtime assets are built by frameos/tools/build_wasm.sh into frontend/public/frameos-wasm and copied into dist/assets by npm run build. npm run sync-version copies the FrameOS version out of the repo's versions.json; publishing refuses to run when the two disagree.

Keywords

frameos

FAQs

Package last updated on 17 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts