Created by OZKA on 26 03 2014 package hello import js jquery native cl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* Created by OZKA on 26.03.2014.
*/
package hello
import js.jquery.*
native class NativeJsObject(_test: Any?) {
fun showAlert() : Unit = js.noImpl
}
native public fun JQuery.hide() : JQuery = js.noImpl
fun callFromJs(text: Any?) {
val container = jq("#kotlinCallContainer")
container.addClass("background-green")
jq("#kotlinCallContainer").text(text.toString())
}
fun main(args: Array<String>) {
js.dom.html.window.document.write("<h3>Hello Kotlin to JavaScript!!!</h3>")
val container = jq("#container")
container.text("Text added by Kotlin/JQuery!")
container.addClass("background-blue")
jq("#btn").click { container.hide() }
jq("#btnNativeCall").click {
val njso = NativeJsObject("Native JavaScript object call from Kotlin!")
njso.showAlert()
}
}