mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
eventbus: remove hacks, add sender
This commit is contained in:

committed by
Alexander Medvednikov

parent
02939d776b
commit
489ec05b23
@ -8,14 +8,20 @@ const (
|
||||
eb = eventbus.new()
|
||||
)
|
||||
|
||||
pub struct Work {
|
||||
pub:
|
||||
hours int
|
||||
}
|
||||
|
||||
pub fn do_work(){
|
||||
work := Work{20}
|
||||
mut params := eventbus.Params{}
|
||||
for i in 0..20 {
|
||||
println("working...")
|
||||
if i == 15 {
|
||||
params.put_string("error", "CRASH!!")
|
||||
eb.publish("error", params)
|
||||
eb.publish("error", params)
|
||||
eb.publish("error", work, params)
|
||||
eb.publish("error", work, params)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user