Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActionInterface ¶
type ActionInterface interface{}
type AppInterface ¶
type AppInterface interface { WatcherInterface DispatcherInterface }
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(notifier NotifierInterface, stores ...StoreInterface) *Dispatcher
NewDispatcher creates a new dispatcher and registers the provided stores
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(action ActionInterface) chan struct{}
Dispatch sends an action to all registered stores
func (*Dispatcher) Register ¶
func (d *Dispatcher) Register(store StoreInterface)
Register adds a store to the dispatcher
type DispatcherInterface ¶
type DispatcherInterface interface {
Dispatch(action ActionInterface) chan struct{}
}
type NotifPayload ¶
type NotifPayload struct { Type Notif Done chan struct{} Data interface{} }
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
func NewNotifier ¶
func NewNotifier() *Notifier
func (*Notifier) Delete ¶
func (s *Notifier) Delete(c chan NotifPayload)
func (*Notifier) Notify ¶
Notify sends the notif notification to all subscribers of that notification for object. If object is nil, the notification is sent to all subscribers.
func (*Notifier) Watch ¶
func (s *Notifier) Watch(object interface{}, notifs ...Notif) chan NotifPayload
Watch returns a channel subscribed to reveive notifs notifications about object. If object is nil, the subscription is for all objects in the store.
type NotifierInterface ¶
type NotifierInterface interface { // Notify sends the notif notification to all subscribers of that // notification for object. If object is nil, the notification is sent to // all subscribers. The chanel returned is closed when the notify action // has finished. Notify(object interface{}, notif Notif, data interface{}) (done chan struct{}) }
type Payload ¶
type Payload struct { Action ActionInterface Done chan struct{} // contains filtered or unexported fields }
func (*Payload) Notify ¶
Notify sends the notif notification to all subscribers of that notification for object. If object is nil, the notification is sent to all subscribers.
func (*Payload) NotifyWithData ¶
func (*Payload) Wait ¶
func (p *Payload) Wait(stores ...StoreInterface)
Wait is used by the store handler to wait for other stores to finish.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Init ¶
func (s *Store) Init(si StoreInterface)
type StoreInterface ¶
type View ¶
type View struct { vecty.Core Ctx context.Context App AppInterface Notifs []chan NotifPayload Self ViewInterface // contains filtered or unexported fields }
func NewView ¶
func NewView(ctx context.Context, self ViewInterface, app AppInterface) *View
func (*View) Receive ¶
func (v *View) Receive(notif NotifPayload)
func (*View) Render ¶
func (v *View) Render() vecty.ComponentOrHTML
type ViewInterface ¶
type ViewInterface interface { vecty.Component Receive(notif NotifPayload) }
type Waiter ¶
type Waiter struct {
// contains filtered or unexported fields
}
Waiter waits for all signals to fire before signalling a done channel
type WatcherInterface ¶
type WatcherInterface interface { // Watch returns a channel subscribed to reveive notifs notifications about // object. If object is nil, the subscription is for all objects in the // store. Watch(object interface{}, notif ...Notif) chan NotifPayload Delete(c chan NotifPayload) }