Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GomlNode

Hierarchy

Implements

  • EventEmitter

Index

Constructors

constructor

Properties

addListener

addListener: function

Type declaration

    • (event: string | symbol, fn: ListenerFn, context?: any): this
    • Parameters

      • event: string | symbol
      • fn: ListenerFn
      • Optional context: any

      Returns this

children

children: GomlNode[] = []

componentsElement

componentsElement: Element

element

element: Element

emit

emit: function

Calls each of the listeners registered for a given event.

Type declaration

    • (event: string | symbol, ...args: Array<any>): boolean
    • Parameters

      • event: string | symbol
      • Rest ...args: Array<any>

      Returns boolean

eventNames

eventNames: function

Return an array listing the events for which the emitter has registered listeners.

Type declaration

    • (): Array<string | symbol>
    • Returns Array<string | symbol>

id

id: string

ID related to this instance to identify.

listeners

listeners: function & function

Return the listeners registered for a given event.

nodeDeclaration

nodeDeclaration: NodeDeclaration

off

off: function

Type declaration

    • (event: string | symbol, fn?: ListenerFn, context?: any, once?: undefined | true | false): this
    • Parameters

      • event: string | symbol
      • Optional fn: ListenerFn
      • Optional context: any
      • Optional once: undefined | true | false

      Returns this

on

on: function

Add a listener for a given event.

Type declaration

    • (event: string | symbol, fn: ListenerFn, context?: any): this
    • Parameters

      • event: string | symbol
      • fn: ListenerFn
      • Optional context: any

      Returns this

once

once: function

Add a one-time listener for a given event.

Type declaration

    • (event: string | symbol, fn: ListenerFn, context?: any): this
    • Parameters

      • event: string | symbol
      • fn: ListenerFn
      • Optional context: any

      Returns this

removeAllListeners

removeAllListeners: function

Remove all listeners, or those of the specified event.

Type declaration

    • (event?: string | symbol): this
    • Parameters

      • Optional event: string | symbol

      Returns this

removeListener

removeListener: function

Remove the listeners of a given event.

Type declaration

    • (event: string | symbol, fn?: ListenerFn, context?: any, once?: undefined | true | false): this
    • Parameters

      • event: string | symbol
      • Optional fn: ListenerFn
      • Optional context: any
      • Optional once: undefined | true | false

      Returns this

Accessors

companion

deleted

  • get deleted(): boolean
  • indicate this node is already deleted. if this node is deleted once, this node will not be mounted.

    Returns boolean

    [description]

enabled

  • get enabled(): boolean
  • set enabled(value: boolean): void
  • indicate this node is enabled. this node never recieve any message if this node is not enabled.

    Returns boolean

    [description]

  • indicate this node is enabled. this node never recieve any message if this node is not enabled.

    Parameters

    • value: boolean

    Returns void

    [description]

hasChildren

  • get hasChildren(): boolean
  • return true if this node has some child nodes.

    Returns boolean

    [description]

index

  • get index(): number
  • Get index of this node from parent.

    Returns number

    number of index.

isActive

  • get isActive(): boolean
  • indicate this node is enabled in tree. This value must be false when ancestor of this node is disabled.

    Returns boolean

    [description]

mounted

  • get mounted(): boolean
  • indicate mounted status. this property to be true when treeroot registered to GrimoireInterface. to be false when this node detachd from the tree.

    Returns boolean

    Whether this node is mounted or not.

name

parent

tree

Methods

_addComponentDirectly

  • _addComponentDirectly(component: Component, isDefaultComponent: boolean): void
  • Internal use! Should not operate by users or plugin developpers

    Parameters

    • component: Component
    • isDefaultComponent: boolean

    Returns void

addAttribute

  • Internal use! Add new attribute. In most of case, users no need to call this method. Use __addAttribute in Component should be used instead.

    Parameters

    Returns Attribute

addChild

  • addChild(child: GomlNode, index?: number | null, elementSync?: boolean): void
  • Add child for this node.

    Parameters

    • child: GomlNode

      child node to add.

    • Optional index: number | null

      index for insert.なければ末尾に追加

    • Default value elementSync: boolean = true

    Returns void

addChildByName

  • addChildByName(nodeName: Name, attributes: object): GomlNode
  • add new instance created by given name and attributes for this node as child.

    Parameters

    • nodeName: Name
    • attributes: object
      • [attrName: string]: any

    Returns GomlNode

addComponent

  • addComponent(component: Name | object, attributes?: object | null, isDefaultComponent?: boolean): Component
  • attach component to this node.

    Parameters

    • component: Name | object
    • Optional attributes: object | null
    • Default value isDefaultComponent: boolean = false

    Returns Component

append

broadcastMessage

  • broadcastMessage(range: number, name: string, args?: any): void
  • broadcastMessage(name: string, args?: any): void
  • sendMessage recursively for children.

    Parameters

    • range: number

      depth for recursive call.0 for only this node.1 for only children.

    • name: string
    • Optional args: any

    Returns void

  • Parameters

    • name: string
    • Optional args: any

    Returns void

callRecursively

  • callRecursively<T>(func: function): T[]

detach

  • detach(): void

detachChild

getAttribute

  • getAttribute(attrName: Name): any

getAttributeRaw

getChildrenByClass

  • getChildrenByClass(className: string): GomlNode[]
  • search from children node by class property. return all nodes has same class as given.

    Parameters

    • className: string

    Returns GomlNode[]

    [description]

getChildrenByNodeName

  • getChildrenByNodeName(nodeName: string): GomlNode[]
  • search from children node by name property. return all nodes has same name as given.

    Parameters

    • nodeName: string

    Returns GomlNode[]

    [description]

getComponent

  • getComponent<T>(name: Name | Ctor<T>): T
  • search component by name from this node.

    Type parameters

    • T

    Parameters

    Returns T

    component found first.

getComponentInAncestor

  • search component in ancectors of this node. return component that found first. return null if component not found.

    Type parameters

    • T

    Parameters

    Returns Nullable<T>

    [description]

getComponents

  • getComponents<T>(filter?: Name | Ctor<T>): T[]

getComponentsInChildren

  • getComponentsInChildren<T>(name: Name | Ctor<T>): T[]

getTypeName

  • getTypeName(): string

isFreezeAttribute

  • isFreezeAttribute(attributeName: string): boolean

notifyActivenessUpdate

  • notifyActivenessUpdate(activeness: boolean): void

queryChildren

  • queryChildren(query: string): GomlNode[]

remove

  • remove(): void

removeAttribute

removeChild

removeComponent

  • removeComponent(component: Component): boolean

removeComponents

  • removeComponents(component: Name | object): boolean

resolveAttributesValue

  • resolveAttributesValue(): void
  • resolve default attribute value for all component. すべてのコンポーネントの属性をエレメントかデフォルト値で初期化

    Returns void

sendInitializedMessage

sendMessage

  • sendMessage(message: string, args?: any): boolean
  • send message to this node. invoke component method has same name as message if this node isActive.

    Parameters

    • message: string
    • Optional args: any

    Returns boolean

    is this node active.

setAttribute

  • setAttribute(attrName: Name, value: any, ignoireFreeze?: boolean): void
  • Parameters

    • attrName: Name
    • value: any
    • Default value ignoireFreeze: boolean = false

    Returns void

setMounted

  • setMounted(mounted: boolean): void
  • Internal use! Update mounted status and emit events

    Parameters

    • mounted: boolean

      Mounted status.

    Returns void

toString

  • toString(): string

toStructualString

  • toStructualString(message?: string): string
  • Get detailed node structure with highlighting node.

    Parameters

    • Default value message: string = ""

    Returns string

    [description]

watch

  • watch(attrName: Name, watcher: function, immediate?: boolean): void
  • Parameters

    • attrName: Name
    • watcher: function
        • (newValue: any, oldValue: any, attr: Attribute): void
        • Parameters

          • newValue: any
          • oldValue: any
          • attr: Attribute

          Returns void

    • Default value immediate: boolean = false

    Returns void

Static fromElement

  • Get actual goml node from element of xml tree.

    Parameters

    • elem: Element

    Returns GomlNode

    [description]

Static getUniqueRandom

  • getUniqueRandom(length: number): string

Generated using TypeDoc