golymer: github.com/microo8/golymer Index | Files | Directories

package golymer

import "github.com/microo8/golymer"

Index

Package Files

attr_path.go data_bindings.go element.go event.go golymer.go template.go text_manipulation.go

func CreateElement Uses

func CreateElement(elementName string) interface{}

CreateElement creates a new instance of an element that can be type asserted to custom element

func Define Uses

func Define(f interface{}) error

Define registers an new custom element takes the constructor of the element func()*YourElemType element is registered under the name converted from your element type (YourElemType -> your-elem-type)

func MustDefine Uses

func MustDefine(f interface{})

MustDefine registers an new custom element takes the constructor of the element func()*YourElemType element is registered under the name converted from your element type (YourElemType -> your-elem-type) if an error occures it panics

type CustomElement Uses

type CustomElement interface {
    ConnectedCallback()
    DisconnectedCallback()
    AttributeChangedCallback(attributeName string, oldValue string, newValue string, namespace string)
    AdoptedCallback(oldDocument, newDocument interface{})
    DispatchEvent(customEvent *Event)
}

CustomElement the interface to create the CustomElement

type Element Uses

type Element struct {
    *js.Object
    ObjValue reflect.Value //custom element struct type
    Children map[string]*js.Object
    // contains filtered or unexported fields
}

Element wrapper for the HTML element

func (*Element) AddEventListener Uses

func (e *Element) AddEventListener(eventName string, f func(*Event))

AddEventListener is an wrapper for the js addEventListener

func (*Element) AdoptedCallback Uses

func (e *Element) AdoptedCallback(oldDocument, newDocument interface{})

AdoptedCallback ...

func (*Element) AttributeChangedCallback Uses

func (e *Element) AttributeChangedCallback(attributeName string, oldValue string, newValue string, namespace string)

AttributeChangedCallback ...

func (*Element) ConnectedCallback Uses

func (e *Element) ConnectedCallback()

ConnectedCallback called when the element is attached to the DOM

func (*Element) DisconnectedCallback Uses

func (e *Element) DisconnectedCallback()

DisconnectedCallback called when the element is dettached from the DOM

func (*Element) DispatchEvent Uses

func (e *Element) DispatchEvent(ce *Event)

DispatchEvent dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order

func (*Element) SetTemplate Uses

func (e *Element) SetTemplate(template Template)

SetTemplate sets this element's template, must be called in own element's constructor, before connectedCallback

type Event Uses

type Event struct {
    *js.Object
    //A Boolean indicating whether the event bubbles up through the DOM or not.
    Bubbles bool `js:"bubbles"`
    //A Boolean indicating whether the event is cancelable.
    Cancelable bool `js:"cancelable"`
    //A Boolean value indicating whether or not the event can bubble across the boundary between the shadow DOM and the regular DOM.
    Composed bool `js:"composed"`
    //A reference to the currently registered target for the event.
    //This is the object to which the event is currently slated to be sent to;
    //it's possible this has been changed along the way through retargeting.
    CurrentTarget *js.Object `js:"currentTarget"`
    //An Array of DOM Nodes through which the event has bubbled.
    DeepPath []*js.Object `js:"deepPath"`
    //Indicates whether or not event.preventDefault() has been called on the event.
    DefaultPrevented bool `js:"defaultPrevented"`
    //Any data passed when initializing the event
    Detail map[string]interface{} `js:"detail"`
    //Indicates which phase of the event flow is being processed.
    EventPhase int `js:"eventPhase"`
    //A reference to the target to which the event was originally dispatched.
    Target *js.Object `js:"target"`
    //The time at which the event was created, in milliseconds.
    //By specification, this value is time since epoch, but in reality browsers' definitions vary;
    //in addition, work is underway to change this to be a DOMHighResTimeStamp instead.
    TimeStamp time.Time `js:"timeStamp"`
    //The name of the event (case-insensitive).
    Type string `js:"type"`
    //Indicates whether not the event was initiated by the browser (after a user click for instance)
    //or by a script (using an event creation method, like event.initEvent)
    IsTrusted bool `js:"isTrusted"`
}

Event represents any event which takes place in the DOM

func NewEvent Uses

func NewEvent(typ string, customEventInit map[string]interface{}) *Event

NewEvent creates new event

func (*Event) StopPropagation Uses

func (e *Event) StopPropagation()

StopPropagation prevents further propagation of the current event in the capturing and bubbling phases

type Template Uses

type Template *js.Object

Template is an html template element ant it's used to instantite new golymer.Element shadowDOM

func NewTemplate Uses

func NewTemplate(str string) Template

NewTemplate creates an template element

Directories

PathSynopsis
test

Package golymer imports 5 packages (graph) and is imported by 1 packages. Updated 2018-06-13. Refresh now. Tools for package owners.