mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
eventbus: add generic support for event name (#18805)
This commit is contained in:
@ -3,7 +3,7 @@ module some_module
|
||||
import eventbus
|
||||
|
||||
const (
|
||||
eb = eventbus.new()
|
||||
eb = eventbus.new[string]()
|
||||
)
|
||||
|
||||
pub struct Duration {
|
||||
@ -29,6 +29,6 @@ pub fn do_work() {
|
||||
some_module.eb.publish('event_baz', &Duration{42}, &EventMetadata{'Additional data at the end.'})
|
||||
}
|
||||
|
||||
pub fn get_subscriber() eventbus.Subscriber {
|
||||
pub fn get_subscriber() eventbus.Subscriber[string] {
|
||||
return *some_module.eb.subscriber
|
||||
}
|
||||
|
Reference in New Issue
Block a user