v/examples/hot_reload/message.v

19 lines
359 B
V
Raw Normal View History

2020-05-01 13:48:00 +02:00
module main
// Build this example with `v -live message.v`
2019-07-07 21:46:21 +02:00
import time
2021-01-16 14:05:01 +01:00
import v.live
2019-07-07 21:46:21 +02:00
[live]
2019-07-07 21:46:21 +02:00
fn print_message() {
info := live.info()
println('OK reloads: ${info.reloads_ok:4d} | Total reloads: ${info.reloads:4d} | Hello! Modify this message while the program is running.')
2019-07-07 21:46:21 +02:00
}
fn main() {
for {
print_message()
2021-02-27 18:41:06 +01:00
time.sleep(500 * time.millisecond)
2019-07-07 21:46:21 +02:00
}
}