mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 23:16:30 +01:00
add and use event bus for UI progress
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package bus
|
||||
|
||||
import "github.com/wagoodman/go-partybus"
|
||||
|
||||
var publisher partybus.Publisher
|
||||
var active bool
|
||||
|
||||
func SetPublisher(p partybus.Publisher) {
|
||||
publisher = p
|
||||
if p != nil {
|
||||
active = true
|
||||
}
|
||||
}
|
||||
|
||||
func Publish(event partybus.Event) {
|
||||
if active {
|
||||
publisher.Publish(event)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user