tui.hook.on
tui.hook.on EVENT FN
Registers FN to run when the framework fires EVENT.
Events
init(aftertui.init),ready(before the first frame),page FILE(after every page switch),resize ROWS COLS,quit(tui.stop),exit(terminal being restored: give back terminal settings and files here),plugin_enabled NAME,plugin_disabled NAME.key NAME: before bindings; a handler that returns0consumes the key.
Notes
- Adding the same
FNtwice for one event is a no-op. Handlers run in registration order. - Available to apps too, not only plugins.
Example
on_page() { tui.log "visited $1"; }
tui.hook.on page on_page
