func (cm *PubSub) UnsubscribeAll(subscriber Subscriber) int {
	if subscriber == nil {
		return 0
	}
	cm.lock.Lock()
	defer cm.lock.Unlock()

	ids, ok := cm.idMap[subscriber]
	if !ok {
		return 0
	}

	idsLen := len(ids)

	for id := range ids {
		cm.unsubscribeOne(id, subscriber)
	}

	return idsLen
}
// UnsubscribeAll - unsubscribes subscriber from every id and returns the number
// of unsubscriptions done
unsubscribes subscriber from every id and returns the number
of unsubscriptions done
// UnsubscribeAll - unsubscribes subscriber from every id and returns the number // of unsubscriptions done
func (cm *PubSub) UnsubscribeAll(subscriber Subscriber) int {
	if subscriber == nil {
		return 0
	}
	cm.lock.Lock()
	defer cm.lock.Unlock()
	ids, ok := cm.idMap[subscriber]
	if !ok {
		return 0
	}
	idsLen := len(ids)
	for id := range ids {
		cm.unsubscribeOne(id, subscriber)
	}
	return idsLen
}
func ( cm * PubSub ) UnsubscribeAll ( subscriber Subscriber ) int { if subscriber == nil { return 0 } cm . lock . Lock ( ) defer cm . lock . Unlock ( ) ids , ok := cm . idMap [ subscriber ] if ! ok { return 0 } idsLen := len ( ids ) for id := range ids { cm . unsubscribeOne ( id , subscriber ) } return idsLen }
unsubscribes subscriber from every id and returns the number
of unsubscriptions done
unsubscribes subscriber from every id and returns the number of unsubscriptions done