Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
feat: add event bus wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Sep 26, 2021
1 parent 355437f commit ca1eeb5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package pluginlib

import "github.com/asaskevich/EventBus"

var bus = EventBus.New()

func Subscribe(eventName string, fn interface{}) error {
return bus.Subscribe(eventName, fn)
}

func Unsubscribe(eventName string, fn interface{}) error {
return bus.Unsubscribe(eventName, fn)
}

func Publish(eventName string, args ...interface{}) {
bus.Publish(eventName, args)
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/getstackhead/pluginlib

go 1.17

require github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef

0 comments on commit ca1eeb5

Please sign in to comment.