1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/examples/eventbus/eventbus.v

19 lines
302 B
V
Raw Normal View History

module main
import (
some_module
eventbus
)
fn main(){
mut sub := some_module.get_subscriber()
sub.subscribe("error", on_error)
some_module.do_work()
}
2019-12-18 08:16:33 +03:00
fn on_error(sender voidptr, p eventbus.Params) {
work := *(*some_module.Work(sender))
println(work.hours)
println(p.get_string("error"))
2019-12-01 10:33:26 +03:00
}