Skip to content

Commit 5d9df19

Browse files
Bootstrap PlayBridgeJS example
1 parent bd933df commit 5d9df19

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

Examples/PlayBridgeJS/Package.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// swift-tools-version:6.0
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "PlayBridgeJS",
7+
platforms: [
8+
.macOS(.v14)
9+
],
10+
dependencies: [.package(name: "JavaScriptKit", path: "../../")],
11+
targets: [
12+
.executableTarget(
13+
name: "PlayBridgeJS",
14+
dependencies: [
15+
"JavaScriptKit",
16+
.product(name: "JavaScriptEventLoop", package: "JavaScriptKit"),
17+
]
18+
)
19+
]
20+
)

Examples/PlayBridgeJS/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Playground for BridgeJS example
2+
3+
Install Development Snapshot toolchain `DEVELOPMENT-SNAPSHOT-2024-07-08-a` from [swift.org/install](https://www.swift.org/install/) and run the following commands:
4+
5+
```sh
6+
$ swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-07-09-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-07-09-a-wasm32-unknown-wasi.artifactbundle.zip
7+
$ ./build.sh
8+
$ npx serve
9+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import JavaScriptEventLoop
2+
import JavaScriptKit
3+
4+
@JS class PlayBridgeJS {
5+
}

Examples/PlayBridgeJS/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
set -ex
3+
swift package --swift-sdk "${SWIFT_SDK_ID:-wasm32-unknown-wasi}" -c "${1:-debug}" js --use-cdn

Examples/PlayBridgeJS/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<title>Getting Started</title>
6+
</head>
7+
8+
<body>
9+
<script type="module">
10+
import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js";
11+
init();
12+
</script>
13+
</body>
14+
15+
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy