mutation

package
v0.0.0-...-5a689ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2018 License: ISC Imports: 2 Imported by: 0

README

mutation

-- import "github.com/MJKWoolnough/gopherjs/mutation"

Package mutation provides a wrapper for the MutationObserver API

Usage

type Observer
type Observer struct {
	*js.Object
}

Observer wraps a MutationObserver javascript object

func New
func New(f func([]*Record, *Observer)) *Observer

New creates a new wrapper around MutationObserver, which is created with the given callback

func (*Observer) Disconnect
func (m *Observer) Disconnect()

Disconnect stops the observer from receiving events

func (*Observer) Observe
func (m *Observer) Observe(n dom.Node, i ObserverInit)

Observe registers a DOM Node to receive events for

func (*Observer) TakeRecords
func (m *Observer) TakeRecords() []*Record

TakeRecords empties the record queue, returning what was in it

type ObserverInit
type ObserverInit struct {
	ChildList             bool
	Attributes            bool
	CharacterData         bool
	Subtree               bool
	AttributeOldValue     bool
	CharacterDataOldValue bool
	AttributeFilter       []string
}

ObserverInit contains the options for observing a Node

type Record
type Record struct {
	*js.Object
	Type               string `js:"type"`
	AttributeName      string `js:"attributeName"`
	AttributeNamespace string `js:"attributeNamespace"`
	OldValue           string `js:"oldValue"`
}

Record is a wrapper around a MutationRecord js type

func (*Record) AddedNodes
func (r *Record) AddedNodes() []dom.Node

AddedNodes returns any nodes that were added

func (*Record) NextSibling
func (r *Record) NextSibling() dom.Node

NextSibling returns the next sibling to any added or removed nodes

func (*Record) PreviousSibling
func (r *Record) PreviousSibling() dom.Node

PreviousSibling returns the previous sibling to any added or removed nodes

func (*Record) RemovedNodes
func (r *Record) RemovedNodes() []dom.Node

RemovedNodes returns any nodes that were added

func (*Record) Target
func (r *Record) Target() dom.Node

Target returns the node associated with the record

Documentation

Overview

Package mutation provides a wrapper for the MutationObserver API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observer

type Observer struct {
	*js.Object
}

Observer wraps a MutationObserver javascript object

func New

func New(f func([]*Record, *Observer)) *Observer

New creates a new wrapper around MutationObserver, which is created with the given callback

func (*Observer) Disconnect

func (m *Observer) Disconnect()

Disconnect stops the observer from receiving events

func (*Observer) Observe

func (m *Observer) Observe(n dom.Node, i ObserverInit)

Observe registers a DOM Node to receive events for

func (*Observer) TakeRecords

func (m *Observer) TakeRecords() []*Record

TakeRecords empties the record queue, returning what was in it

type ObserverInit

type ObserverInit struct {
	ChildList             bool
	Attributes            bool
	CharacterData         bool
	Subtree               bool
	AttributeOldValue     bool
	CharacterDataOldValue bool
	AttributeFilter       []string
}

ObserverInit contains the options for observing a Node

type Record

type Record struct {
	*js.Object
	Type               string `js:"type"`
	AttributeName      string `js:"attributeName"`
	AttributeNamespace string `js:"attributeNamespace"`
	OldValue           string `js:"oldValue"`
}

Record is a wrapper around a MutationRecord js type

func (*Record) AddedNodes

func (r *Record) AddedNodes() []dom.Node

AddedNodes returns any nodes that were added

func (*Record) NextSibling

func (r *Record) NextSibling() dom.Node

NextSibling returns the next sibling to any added or removed nodes

func (*Record) PreviousSibling

func (r *Record) PreviousSibling() dom.Node

PreviousSibling returns the previous sibling to any added or removed nodes

func (*Record) RemovedNodes

func (r *Record) RemovedNodes() []dom.Node

RemovedNodes returns any nodes that were added

func (*Record) Target

func (r *Record) Target() dom.Node

Target returns the node associated with the record

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL