21 lines
278 B
Go
21 lines
278 B
Go
package events
|
|
|
|
type ISubscription interface {
|
|
Unsubscribe()
|
|
}
|
|
|
|
func newSubscription(remove func()) ISubscription {
|
|
sub := &subscription{
|
|
remove: remove,
|
|
}
|
|
return sub
|
|
}
|
|
|
|
type subscription struct {
|
|
remove func()
|
|
}
|
|
|
|
func (sub *subscription) Unsubscribe() {
|
|
sub.remove()
|
|
}
|