You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[JavaScriptKit](https://github.com/swiftwasm/JavaScriptKit) is a Swift framework to interact with JavaScript through WebAssembly.
4
-
5
-
You can use any JavaScript API from Swift with this library. Here's a quick example of JavaScriptKit
6
-
usage in a browser app:
7
-
8
-
```swift
9
-
importJavaScriptKit
10
-
11
-
let document = JSObject.global.document
12
-
13
-
var divElement = document.createElement("div")
14
-
divElement.innerText="Hello, world"
15
-
_= document.body.appendChild(divElement)
16
-
```
17
-
18
-
You can also use JavaScriptKit in SwiftWasm apps integrated with Node.js, as there no assumptions
19
-
that any browser API is present in the library.
20
-
21
-
JavaScriptKit consists of a runtime library package [hosted on
22
-
npm](https://www.npmjs.com/package/javascript-kit-swift), and a SwiftPM package for the API on the
23
-
Swift side. To integrate the JavaScript runtime automatically into your app, we recommend following
24
-
the corresponding [guide for browser apps in our book](./browser-app.md).
25
-
26
-
27
-
You can get more detailed JavaScriptKit documentation [here](https://swiftwasm.github.io/JavaScriptKit/).
3
+
See the [JavaScriptKit documentation](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit) for details on how to interact with JavaScript from Swift.
0 commit comments