kiesel-js/web-runtime
🌐 A web compatible runtime for the Kiesel JavaScript engine
- Zig 100%
| .forgejo/workflows | Update to Zig 0.16 | |
| src | Update to Zig 0.16 | |
| .gitignore | zig-cache -> .zig-cache | |
| build.zig | Update to Zig 0.16 | |
| build.zig.zon | Update to Zig 0.16 | |
| LICENSE | Initial commit | |
| README.md | Rename to web-runtime | |
Kiesel Web Runtime
🌐 A web compatible runtime for the Kiesel JavaScript engine
justforfunnoreally.dev badge License
Introduction
The goal for this project roughly aligns with the WinterTC
Minimum Common Web Platform API.
Kiesel itself only provides an implementation of ECMA-262 and ECMA-402, other
commonly available APIs like console will be implemented here.
Build
To include this runtime in your own project using Kiesel for JS evaluation:
-
Add the dependency to your
build.zig.zon:zig fetch --save git+https://codeberg.org/kiesel-js/web-runtime -
Supply the
kieselmodule import:constkiesel=b.dependency("kiesel");constkiesel_web_runtime=b.dependency("kiesel-web-runtime");kiesel_web_runtime.module("kiesel-web-runtime").addImport("kiesel",kiesel.module("kiesel")); -
Add bindings to an object (usually the global object) as follows:
constkiesel_web_runtime=@import("kiesel-web-runtime");// ...trykiesel_web_runtime.addBindings(realm,global_object);
Available APIs
Blob()Blob.prototype.arrayBuffer()Blob.prototype.bytes()Blob.prototype.sizeBlob.prototype.text()Blob.prototype.typeconsole.assert()console.debug()console.error()console.info()console.log()console.warn()crypto.getRandomValues()crypto.randomUUID()fetch()(using synchronous networking for now. sue me)navigator.userAgentperformance.now()performance.timeOriginqueueMicrotask()TextDecoder()TextDecoder.prototype.decode()TextDecoder.prototype.encodingTextDecoder.prototype.fatalTextDecoder.prototype.ignoreBOMTextEncoder()TextEncoder.prototype.encode()TextEncoder.prototype.encoding