NotifyAll messages the notifier's notifiees with a given notification. This is done by calling the given function with each notifiee. It is meant to be called with your own type-safe notification functions:

func (r *Rocket) Launch() {
  r.notifyAll(func(n Notifiee) {

// make it private so only you can use it. This function is necessary
// to make sure you only up-cast in one place. You control who you added
// to be a notifiee. If Go adds generics, maybe we can get rid of this
// method but for now it is like wrapping a type-less container with
// a type safe interface.
func (r *Rocket) notifyAll(notify func(Notifiee)) {
  r.notifier.NotifyAll(func(n notifier.Notifiee) {

Note well: each notification is launched in its own goroutine, so they can be processed concurrently, and so that whatever the notification does it _never_ blocks out the client. This is so that consumers _cannot_ add hooks into your object that block you accidentally.

NotifyAll is referenced in 0 repositories