Files
endorphin-tessera-gui/examples/exit-lifecycle.endor
2026-10-24 01:01:22 +08:00

18 lines
535 B
Plaintext

class ExitText: TextBlock {
log: Object
function onUnmount(self: ExitText, mount: Mount): Unit {
self.log.increment()
}
}
log = ui.state(0)
watched = ExitText("关闭副窗口可观察卸载计数;退出应用也会卸载剩余位置",2,log)
page = Page()
page.title = "退出生命周期"
page.render(Column(24,16,watched,ui.textOf(log,"value")))
second = Window()
second.setTitle("Exit lifecycle secondary")
other = Page()
other.render(watched)
other.moveToWindow(second)
pending = ui.sleep(ui,"pending",30000)