Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This Go package allows you to set handler functions that run when named events occur.

License

NotificationsYou must be signed in to change notification settings

theTardigrade/golang-events

Repository files navigation

This Go package allows you to set handler functions that run when named events occur.

Go ReferenceGo Report Card

Example

package mainimport ("fmt""time"events"github.com/theTardigrade/golang-events")funcmain() {manager:=events.NewManager()manager.Add(events.AddOptions{Handler:func() {fmt.Println("THIS HANDLER IS CALLED WHEN EVENT ONE RUNS")},Name:"one",ShouldWaitTillDone:true,})manager.Add(events.AddOptions{Handler:func() {fmt.Println("THIS HANDLER IS CALLED WHEN EVENT TWO RUNS")},Name:"two",ShouldWaitTillDone:true,})manager.Add(events.AddOptions{Handler:func() {fmt.Println("THIS HANDLER IS CALLED WHEN EITHER EVENT ONE OR EVENT TWO RUNS")},Names:              []string{"one","two"},ShouldWaitTillDone:true,})fmt.Println("***")manager.Run("one")fmt.Println("***")manager.Run("two")fmt.Println("***")manager.Run("one","two")fmt.Println("***")manager.RunAll()fmt.Println("***")}

Support

If you use this package, or find any value in it, please consider donating:

ko-fi

About

This Go package allows you to set handler functions that run when named events occur.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp