Documentation
¶
Overview ¶
Example (Basic) ¶
package main
import (
"fmt"
"github.com/ysmood/goob"
)
func main() {
// create an observable instance
ob := goob.New()
defer ob.Close()
events := ob.Subscribe()
// publish events without blocking
ob.Publish(1)
ob.Publish(2)
ob.Publish(3)
// consume events
for e := range events {
fmt.Print(e)
if e.(int) == 3 {
break
}
}
}
Output: 123
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Observable ¶
type Observable struct {
// contains filtered or unexported fields
}
Observable hub
func (*Observable) Unsubscribe ¶ added in v0.3.0
func (ob *Observable) Unsubscribe(s Subscriber)
Unsubscribe from observable
Click to show internal directories.
Click to hide internal directories.