1
0
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:
Abdullah Atta
2019-12-18 10:16:33 +05:00
committed by Alexander Medvednikov
parent 02939d776b
commit 489ec05b23
6 changed files with 148 additions and 139 deletions

View File

@ -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
}
}