Skip to content

An interactive, browser-based sandbox to build, test and share scripts for interacting with a Z-Wave controller

Notifications You must be signed in to change notification settings

zwave-js/playground

Repository files navigation

Z-Wave JS Playground

An interactive, browser-based sandbox to build, test and share scripts for interacting with a Z-Wave controller.

Fully-local: All code is executed locally in your browser, and is not sent to any server. Only type declarations are fetched from jsDelivr.

Rich editor: The built-in editor provides syntax highlighting, code completion, and error checking.

Sharing and embedding: Share your scripts with others by copying the URL, or embed them in an iframe your own website.

Screenshot

How it works

  • esbuild is used to pre-bundle Z-Wave JS while eliminating browser-incompatible dependencies and transpile your TypeScript code in the browser
  • Monaco Editor powers the code editor
  • TypeScript and @typescript/ata are used to automatically download the type definitions
  • @zwave-js/bindings-browser allows Z-Wave JS to use the browser's Web Serial and storage APIs

When you press Run, the code is transpiled locally using esbuild. The playground hooks it up to a serial port (requires a Chromium-based browser) and executes it. The browser console output is redirected to the console panel.

Some of these dependencies are pretty big (roughly 30 MB total), so the initial load might take a while. When embedded, the playground will ask first whether it should load the dependencies.

Embedding

You can embed the playground in your own website using an iframe. Click the Embed button to get the URL for the iframe. Because the playground requires access to the serial port, these permissions must be granted explicitly:

<iframe allow="serial" src="..."></iframe>

We recommend a height of at least 750px for the iframe.

About

An interactive, browser-based sandbox to build, test and share scripts for interacting with a Z-Wave controller

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published