File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Example/JavaScriptKitExample/Sources/JavaScriptKitExample Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : Check compatibility
2
+ on : [push, pull_request]
3
+ jobs :
4
+ test :
5
+ name : Check source code compatibility
6
+ runs-on : Ubuntu-18.04
7
+ steps :
8
+ - name : Checkout
9
+ uses : actions/checkout@master
10
+ with :
11
+ fetch-depth : 1
12
+ - name : Run Test
13
+ run : |
14
+ git clone https://github.com/kylef/swiftenv.git ~/.swiftenv
15
+ export SWIFTENV_ROOT="$HOME/.swiftenv"
16
+ export PATH="$SWIFTENV_ROOT/bin:$PATH"
17
+ eval "$(swiftenv init -)"
18
+ make bootstrap
19
+ cd Example
20
+ swift build --triple wasm32-unknonw-wasi
Original file line number Diff line number Diff line change 1
1
import JavaScriptKit
2
2
3
- let alert = JSObjectRef . global. alert. function!
4
- let document = JSObjectRef . global. document. object!
3
+ let alert = JSObject . global. alert. function!
4
+ let document = JSObject . global. document. object!
5
5
6
6
let divElement = document. createElement!( " div " ) . object!
7
7
divElement. innerText = " Hello, world "
@@ -10,6 +10,7 @@ _ = body.appendChild!(divElement)
10
10
11
11
let buttonElement = document. createElement!( " button " ) . object!
12
12
buttonElement. innerText = " Click me! "
13
+ let onClickListener =
13
14
buttonElement. onclick = . function { _ in
14
15
alert ( " Swift is running on browser! " )
15
16
}
You can’t perform that action at this time.
0 commit comments