Documentation
¶
Index ¶
- func AttributeFilter(val ...string) func(*Options)
- func AttributeOldValue(o *Options)
- func Attributes(o *Options)
- func CharacterData(o *Options)
- func CharacterDataOldValue(o *Options)
- func ChildList(o *Options)
- func Subtree(o *Options)
- type Callback
- type CallbackFunc
- type Flusher
- type FlusherSet
- type Flushers
- type ObserveOption
- type Observer
- type Options
- type Record
- type RecordCallbackFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttributeFilter ¶
func AttributeOldValue ¶
func AttributeOldValue(o *Options)
func Attributes ¶
func Attributes(o *Options)
func CharacterData ¶
func CharacterData(o *Options)
func CharacterDataOldValue ¶
func CharacterDataOldValue(o *Options)
Types ¶
type CallbackFunc ¶
func (CallbackFunc) HandleMutation ¶
func (f CallbackFunc) HandleMutation(r []Record, o *Observer)
type FlusherSet ¶ added in v0.6.0
type FlusherSet struct {
// contains filtered or unexported fields
}
func (*FlusherSet) AddFlusher ¶ added in v0.6.0
func (r *FlusherSet) AddFlusher(f Flusher)
func (*FlusherSet) Flush ¶ added in v0.6.0
func (r *FlusherSet) Flush()
func (*FlusherSet) RemoveFlusher ¶ added in v0.6.0
func (r *FlusherSet) RemoveFlusher(f Flusher)
type ObserveOption ¶ added in v0.6.0
type ObserveOption = func(*Options)
type Observer ¶
type Observer struct { Flushers Flushers Callback Callback // contains filtered or unexported fields }
Observer implements behaviour of the MutationObserver, allowing client code to react to changes to the DOM. Mutation events are not published immediately; but before control returns to the event loop, (i.e. if an event hander generates two mutation events, an observer will not receive any events before the function has finished executing). The records can be pulled from the Observer.TakeRecords function.
Client code must first call [MutationObserver.Observe], specifying what to listen for.
The Observer must be initialized with both a Flushers, allowing it to register to receive notifications; and a Callback.
func NewObserver ¶
NewObserver creates a new observer registering with the Flushers f and the callback cb. NewObserver doesn't do anything except setting exported fields. The function panics if either f or cb are nil.
func (*Observer) Disconnect ¶
func (o *Observer) Disconnect()
func (*Observer) Flush ¶
func (o *Observer) Flush()
Flush sends recorded events to the registered event handler. You generally don't need to call flush, as events should be pushed when returning to the "event loop".
func (*Observer) Observe ¶
Start observing for changes for a specific dom node.
Panics if the observer does not have a handler.
func (*Observer) Process ¶
func (o *Observer) Process(e dom.ChangeEvent)
func (*Observer) TakeRecords ¶
type Options ¶
type Options = dominterfaces.MutationObserverInit
type Record ¶
type Record = dominterfaces.MutationRecord
type RecordCallbackFunc ¶
type RecordCallbackFunc func([]Record)
func (RecordCallbackFunc) HandleMutation ¶
func (f RecordCallbackFunc) HandleMutation(r []Record, _ *Observer)