mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
eventbus: make it usable and add README
This commit is contained in:

committed by
Alexander Medvednikov

parent
a74f4a661d
commit
d4ae39348f
16
examples/eventbus/eventbus.v
Normal file
16
examples/eventbus/eventbus.v
Normal file
@ -0,0 +1,16 @@
|
||||
module main
|
||||
|
||||
import (
|
||||
some_module
|
||||
eventbus
|
||||
)
|
||||
|
||||
fn main(){
|
||||
mut sub := some_module.get_subscriber()
|
||||
sub.subscribe("error", on_error)
|
||||
some_module.do_work()
|
||||
}
|
||||
|
||||
fn on_error(p eventbus.Params) {
|
||||
println(p.get_string("error"))
|
||||
}
|
Reference in New Issue
Block a user