13 lines
602 B
Plaintext
13 lines
602 B
Plaintext
received = ui.state(Event("waiting"))
|
|
count = ui.state(0)
|
|
function eventKind(): String { return received.value.kind }
|
|
label = TextBlock("waiting")
|
|
subscription = label.bind("text", eventKind)
|
|
withEvent = Button("传递 Event 给原生 set")
|
|
firstConnection = withEvent.on("click", received.set)
|
|
withoutEvent = Button("调用零参数原生 increment")
|
|
secondConnection = withoutEvent.on("click", count.increment)
|
|
page = Page()
|
|
page.title = "原生方法签名"
|
|
page.render(Column(24, 16, TextBlock("源码和原生回调共用参数契约"), label, ui.textOf(count, "value"), withEvent, withoutEvent))
|