Skip to content
New issue

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

如何自定义event,我看用的是默认的全局,可否拆出来使用? #52

Open
cjf621 opened this issue Jun 18, 2023 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@cjf621
Copy link

cjf621 commented Jun 18, 2023

No description provided.

@inhere
Copy link
Member

inhere commented Jun 18, 2023

拆出来使用 - 要怎么用?写个简单的示例看看呢

@inhere inhere self-assigned this Jun 18, 2023
@inhere inhere added the question Further information is requested label Jun 18, 2023
@inhere
Copy link
Member

inhere commented Jun 20, 2023

编写自定义事件Event,嵌入 event.BasicEvent 就可以了

package mypgk

import "github.com/gookit/event"

type MyEvent struct {
	event.BasicEvent
	customData string
}

func (e *MyEvent) CustomData() string {
	return e.customData
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants