We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System (please complete the following information):
macOS
1.22.1
1.1.2
Describe the bug
panic: interface conversion: event.Event is *event.BasicEvent, not *main.MmyEvent
To Reproduce
package main import ( "fmt" "github.com/gookit/event" ) type MyEvent struct { event.BasicEvent customData string } func (e *MyEvent) CustomData() string { return e.customData } func main() { e := &MyEvent{customData: "hello"} e.SetName("e1") event.AddEvent(e) // add listener event.On("e1", event.ListenerFunc(func(e event.Event) error { fmt.Printf("custom Data: %s\n", e.(*MyEvent).CustomData()) return nil })) // trigger event.Fire("e1", nil) }
panic: interface conversion: event.Event is *event.BasicEvent, not *main.MyEvent goroutine 1 [running]: main.main.func1({0x102873790?, 0x140001102d0?}) /Users/m.arduanov/go/src/tt/main.go:25 +0xa4 github.com/gookit/event.ListenerFunc.Handle(0x1400012e048?, {0x102873790?, 0x140001102d0?}) /Users/m.arduanov/go/pkg/mod/github.com/gookit/[email protected]/listener.go:18 +0x34 github.com/gookit/event.(*Manager).fireSimpleMode(0x14000136000, {0x102828f15, 0x2}, {0x102873790, 0x140001102d0}) /Users/m.arduanov/go/pkg/mod/github.com/gookit/[email protected]/manager.go:269 +0xb4 github.com/gookit/event.(*Manager).FireEvent(0x14000136000, {0x102873790, 0x140001102d0}) /Users/m.arduanov/go/pkg/mod/github.com/gookit/[email protected]/manager.go:243 +0x12c github.com/gookit/event.(*Manager).fireByName(0x14000136000, {0x102828f15?, 0x2?}, 0x0, 0x0) /Users/m.arduanov/go/pkg/mod/github.com/gookit/[email protected]/manager.go:221 +0x1d0 github.com/gookit/event.(*Manager).Fire(...) /Users/m.arduanov/go/pkg/mod/github.com/gookit/[email protected]/manager.go:173 github.com/gookit/event.Fire(...) /Users/m.arduanov/go/pkg/mod/github.com/gookit/[email protected]/std.go:67 main.main() /Users/m.arduanov/go/src/tt/main.go:30 +0xd0 exit status 2
Expected behavior
Listener get MyEvent with CustomData()
The text was updated successfully, but these errors were encountered:
but FireEvent works perfect
FireEvent
event.FireEvent(e)
Sorry, something went wrong.
inhere
No branches or pull requests
System (please complete the following information):
macOS
1.22.1
1.1.2
Describe the bug
panic: interface conversion: event.Event is *event.BasicEvent, not *main.MmyEvent
To Reproduce
Expected behavior
Listener get MyEvent with CustomData()
The text was updated successfully, but these errors were encountered: