File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Example/JavaScriptKitExample/Sources/JavaScriptKitExample Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11import JavaScriptKit
22
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!
55
66let divElement = document. createElement!( " div " ) . object!
77divElement. innerText = " Hello, world "
@@ -10,8 +10,9 @@ _ = body.appendChild!(divElement)
1010
1111let buttonElement = document. createElement!( " button " ) . object!
1212buttonElement. innerText = " Click me! "
13- buttonElement . onclick = . function { _ in
13+ let listener = JSClosure { _ in
1414 alert ( " Swift is running on browser! " )
1515}
16+ buttonElement. onclick = . function( listener)
1617
1718_ = body. appendChild!( buttonElement)
You can’t perform that action at this time.
0 commit comments