Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Check source code compatibility #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check compatibility
on:
pull_request:
push:
branches: [master]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should refer to main

jobs:
test:
name: Check source code compatibility
runs-on: Ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Run Test
run: |
git clone https://github.com/kylef/swiftenv.git ~/.swiftenv
export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="$SWIFTENV_ROOT/bin:$PATH"
eval "$(swiftenv init -)"
make bootstrap
cd Example
swift build --triple wasm32-unknonw-wasi
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import JavaScriptKit

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

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

let buttonElement = document.createElement!("button").object!
var buttonElement = document.createElement("button")
buttonElement.innerText = "Click me!"
buttonElement.onclick = .function { _ in
let listener = JSClosure { _ in
alert("Swift is running on browser!")
}
buttonElement.onclick = .function(listener)

_ = body.appendChild!(buttonElement)
_ = document.body.appendChild(buttonElement)