Documentation ¶
Overview ¶
Package tree provides a generic Node interface to build tree data structures.
Index ¶
- Variables
- func BeforeMountEventListener(handler func(BeforeMountEvent)) (events.Type, events.Handler)
- func BeforeUnmountEventListener(handler func(BeforeUnmountEvent)) (events.Type, events.Handler)
- func IsRoot[T events.Target](n Node[T]) bool
- func MountedEventListener(handler func(MountedEvent)) (events.Type, events.Handler)
- func UnmountedEventListener(handler func(UnmountedEvent)) (events.Type, events.Handler)
- type BeforeMountEvent
- type BeforeUnmountEvent
- type MountedEvent
- type Node
- type NodeData
- type UnmountedEvent
Constants ¶
This section is empty.
Variables ¶
var BeforeMountEventType = events.NewType("BeforeMountNode")
var BeforeUnmountEventType = events.NewType("BeforeUnmountNode")
var MountedEventType = events.NewType("MountedNode")
var UnmountedEventType = events.NewType("UnmountedNode")
Functions ¶
func BeforeMountEventListener ¶
func BeforeMountEventListener(handler func(BeforeMountEvent)) (events.Type, events.Handler)
BeforeMountEventListener returns an events.Listener that will call the given handler on before mount node events.
func BeforeUnmountEventListener ¶
func BeforeUnmountEventListener(handler func(BeforeUnmountEvent)) (events.Type, events.Handler)
BeforeUnmountEventListener returns an events.Listener that will call the given handler on before unmount node events.
func MountedEventListener ¶
func MountedEventListener(handler func(MountedEvent)) (events.Type, events.Handler)
MountedEventListener returns an events.Listener that will call the given handler on mounted node events.
func UnmountedEventListener ¶
func UnmountedEventListener(handler func(UnmountedEvent)) (events.Type, events.Handler)
UnmountedEventListener returns an events.Listener that will call the given handler on unmounted node events.
Types ¶
type BeforeMountEvent ¶
BeforeMountEvent is dispatched before a node is mounted into a parent node.
func (BeforeMountEvent) WithTarget ¶
func (bme BeforeMountEvent) WithTarget(t events.Target) events.Event
WithTarget implements events.Event.
type BeforeUnmountEvent ¶
BeforeUnmountEvent is dispatched before a node is unmounted from parent node.
func (BeforeUnmountEvent) WithTarget ¶
func (bue BeforeUnmountEvent) WithTarget(t events.Target) events.Event
WithTarget implements events.Event.
type MountedEvent ¶
MountedEvent is dispatched after a node is mounted into a parent node.
func (MountedEvent) WithTarget ¶
func (me MountedEvent) WithTarget(t events.Target) events.Event
WithTarget implements events.Event.
type Node ¶
type Node[T NodeData] interface { UnwrapNode() *T ParentNode() *T RootNode() *T NextNode() *T PreviousNode() *T FirstChildNode() *T LastChildNode() *T AppendChildNode(*T) error InsertBeforeNode(newChild, reference *T) error RemoveChildNode(*T) error IsAncestorOfNode(*T) bool IsDescendantOfNode(*T) bool }
type UnmountedEvent ¶
UnmountedEvent is dispatched before a node is unmounted from parent node.
func (UnmountedEvent) WithTarget ¶
func (ue UnmountedEvent) WithTarget(t events.Target) events.Event
WithTarget implements events.Event.