// Unwatch remove the given callback from the callback chain of a event.
Unwatch remove the given callback from the callback chain of a event.
// Unwatch remove the given callback from the callback chain of a event .
func (b *bus) Unwatch(event string, callback Callback) {
	var filtered []Callback
	target := reflect.ValueOf(callback).Pointer()
	if actual, ok := b.callbacks.Load(event); ok {
		for _, h := range actual.([]Callback) {
			if reflect.ValueOf(h).Pointer() != target {
				filtered = append(filtered, h)
			}
		}
		b.callbacks.Store(event, filtered)
	}
}
func ( b * bus ) Unwatch ( event string , callback Callback ) { var filtered [ ] Callback target := reflect . ValueOf ( callback ) . Pointer ( ) if actual , ok := b . callbacks . Load ( event ) ; ok { for _ , h := range actual . ( [ ] Callback ) { if reflect . ValueOf ( h ) . Pointer ( ) != target { filtered = append ( filtered , h ) } } b . callbacks . Store ( event , filtered ) } }
Unwatch remove the given callback from the callback chain of a event.
Unwatch remove the given callback from the callback chain of a event .
// In go, functions are not comparable, so we use reflect.ValueOf(callback).Pointer() to reflect their address for comparision.