Documentation ¶
Index ¶
- func Bubble(e IEvent, ls EventListeners) (err error)
- func Capture(e IEvent, ls EventListeners) (err error)
- type EventListeners
- type IEvent
- type IListen
- type ITarget
- type Message
- type PathList
- type Phase
- type Proc
- func (evt *Proc) Bubbles() bool
- func (evt *Proc) Cancelable() bool
- func (evt *Proc) CurrentTarget() ITarget
- func (evt *Proc) Data() interface{}
- func (evt *Proc) DefaultBlocked() bool
- func (evt *Proc) Id() ident.Id
- func (evt *Proc) Path() PathList
- func (evt *Proc) Phase() Phase
- func (evt *Proc) PreventDefault() bool
- func (evt *Proc) StopImmediatePropagation()
- func (evt *Proc) StopPropagation()
- func (evt *Proc) Target() ITarget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bubble ¶
func Bubble(e IEvent, ls EventListeners) (err error)
func Capture ¶
func Capture(e IEvent, ls EventListeners) (err error)
Types ¶
type EventListeners ¶
EventListeners provides the helper code a way to traverse listeners.
type IEvent ¶
type IEvent interface { Id() ident.Id Data() interface{} Bubbles() bool Cancelable() bool DefaultBlocked() bool Target() ITarget // ultimate endpoint for the event Path() PathList Phase() Phase CurrentTarget() ITarget // which changes as the event captures and bubbles // cancel the default action // returns true if now cancelled PreventDefault() bool // stop processing the event flow after this set is done StopPropagation() // stop processing all other event handlers immediately StopImmediatePropagation() }
IEvent implemented as interface to help show callers are not intended to modify, but since we cant inherit, and i dont want to implement 100 functions for every event a generic data() seems required.
type IListen ¶
type IListen interface { // FIX: does dispatch really need an error handling? HandleEvent(IEvent) error }
IListen in order to handle event callbacks. Uses an interface for facilitating add/remove event listeners; comparing function pointers is error-prone in go (due to closures)
type ITarget ¶
type ITarget interface { Id() ident.Id Parent() (ITarget, bool) // used by path.addPath TargetDispatch(IEvent) error // used by proc.sendToTarget, Send(path PathList) }
ITarget dispatch events to some hierarchical node, for instance, in a DOM. FIX: i wonder whether instead of having ITarget ( target could be an id ) the focus could be around Path: rather than building ( and copying ) the path ahead of time, instead: have a path interface which the caller implements. dispatch could be to a path node. evaluate what dispatch needs, not what we want to give it.
type Proc ¶
type Proc struct {
// contains filtered or unexported fields
}
Proc implements IEvent
func (*Proc) Cancelable ¶
func (*Proc) CurrentTarget ¶
func (*Proc) DefaultBlocked ¶
func (*Proc) PreventDefault ¶
func (*Proc) StopImmediatePropagation ¶
func (evt *Proc) StopImmediatePropagation()
func (*Proc) StopPropagation ¶
func (evt *Proc) StopPropagation()