Documentation
¶
Overview ¶
Example (Basic) ¶
package main
import (
"context"
"fmt"
"time"
"github.com/ysmood/goob"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
defer cancel()
// create an observable instance
ob := goob.New(ctx)
events := ob.Subscribe(context.TODO())
// publish events without blocking
ob.Publish(1)
ob.Publish(2)
ob.Publish(3)
// consume events
for e := range events {
fmt.Print(e)
}
}
Output: 123
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Observable ¶
type Observable struct {
// contains filtered or unexported fields
}
Observable hub
Click to show internal directories.
Click to hide internal directories.