Skip to content

iOS-Swift-Controls/JavaScriptKit

Repository files navigation

JavaScriptKit

Run unit tests

Swift framework to interact with JavaScript through WebAssembly.

Usage

This JavaScript code

const alert = window.alert
const document = window.document

const divElement = document.createElement("div")
divElement.innerText = "Hello, world"
const body = document.body
body.appendChild(divElement)

alert("JavaScript is running on browser!")

Can be written in Swift using JavaScriptKit

import JavaScriptKit

let alert = JSObjectRef.global.alert.function!
let document = JSObjectRef.global.document.object!

let divElement = document.createElement!("div").object!
divElement.innerText = "Hello, world"
let body = document.body.object!
_ = body.appendChild!(divElement)

alert("Swift is running on browser!")

Please see Example directory for more information

About

Swift framework to interact with JavaScript through WebAssembly.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 66.9%
  • TypeScript 19.9%
  • C 5.7%
  • JavaScript 5.4%
  • Makefile 1.9%
  • HTML 0.2%