Home Manual Reference Source Test
public class | source

Component

Utility methods of Web Component

Test:

Static Member Summary

Static Public Members
public static get

Static Method Summary

Static Public Methods
public static

instanceOf(node: Node): HTMLElement

Get the closest parent Component instance from a Node

Member Summary

Public Members
public get
public
public get
public get

Shared State manager

public get

view: View

Main view of this component

Method Summary

Public Methods
public

$(selector: string): Element[]

public

$slot(selector: string): Element[]

public

async construct(option: Object)

public

on(type: string, selector: string, callback: EventHandler): Element

Delegate listener for DOM events

public
public

trigger(event: String | Event, detail: *, bubbles: Boolean, cancelable: Boolean, composed: Boolean): Boolean

Protected Methods
protected

attributeChangedCallback(name: string, oldValue: string, newValue: string): *

Assign the new value to the DOM property which has the same name of the changed attribute

protected

Static Public Members

public static get tagName: string source

Test:

Static Public Methods

public static instanceOf(node: Node): HTMLElement source

Get the closest parent Component instance from a Node

Params:

NameTypeAttributeDescription
node Node

Return:

HTMLElement (nullable: true)

Public Members

public get [Symbol.toStringTag]: * source

public [shadow_root]: * source

public get ready: Promise source

public get store: Object source

Shared State manager

public get view: View source

Main view of this component

Public Methods

public $(selector: string): Element[] source

Params:

NameTypeAttributeDescription
selector string

CSS selector

Return:

Element[]

Element set which matches selector in this Shadow DOM

public $slot(selector: string): Element[] source

Params:

NameTypeAttributeDescription
selector string

CSS selector

Return:

Element[]

Matched elements which assigned to slots

public async construct(option: Object) source

Params:

NameTypeAttributeDescription
option Object
  • nullable: true

https://developer.mozilla.org/en-US/docs/Web/API/element/attachShadow#Parameters

Test:

public on(type: string, selector: string, callback: EventHandler): Element source

Delegate listener for DOM events

Params:

NameTypeAttributeDescription
type string

Name of a DOM event

selector string
  • optional

CSS selector of delegate elements

callback EventHandler

Return:

Element

This element

Test:

public render(data: Object): Promise source

Params:

NameTypeAttributeDescription
data Object

Return:

Promise

public trigger(event: String | Event, detail: *, bubbles: Boolean, cancelable: Boolean, composed: Boolean): Boolean source

Params:

NameTypeAttributeDescription
event String | Event
detail *
  • nullable: true

Additional data

bubbles Boolean
  • nullable: true
cancelable Boolean
  • nullable: true
composed Boolean
  • nullable: true

Whether the event will cross from the shadow DOM into the standard DOM after reaching the shadow root

Return:

Boolean

Event be canceled or not

Test:

Protected Methods

protected attributeChangedCallback(name: string, oldValue: string, newValue: string): * source

Assign the new value to the DOM property which has the same name of the changed attribute

Params:

NameTypeAttributeDescription
name string
oldValue string
  • nullable: true
newValue string
  • nullable: true

Return:

*

DOM property value of newValue

protected connectedCallback() source

Test: