Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Node<T>

Type Parameters

Hierarchy

Index

Constructors

  • new Node<T>(name?: string): Node<T>

Properties

_listeners: Map<string, TinoeEventListener[]>
children: T[]
name: string
parent: T

Methods

  • _addChild(c: T): void
  • 添加子节点

    Parameters

    • c: T

      子节点

    Returns void

  • _removeChild(c: T): void
  • 删除子节点

    Parameters

    • c: T

      子节点

    Returns void

  • addChildren(...children: T[]): void
  • 添加1~n个子节点

    Parameters

    • Rest ...children: T[]

      待添加节点

    Returns void

  • addEventListener(type: string, handler: ((data: any) => any), once?: boolean): void
  • 注册handler

    memberof

    EventEmitter

    Parameters

    • type: string
    • handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    • Optional once: boolean

    Returns void

  • destroy(): void
  • 销毁

    Returns void

  • dispatch(type: string, data?: any): void
  • 派发事件

    memberof

    EventEmitter

    Parameters

    • type: string
    • Optional data: any

    Returns void

  • getChildByName(name: string, findAll?: boolean): T | Node<Node<any>>[]
  • 根据name标识查找子节点

    Parameters

    • name: string

      标识

    • Optional findAll: boolean

      是否查找所有符合name标识的节点

    Returns T | Node<Node<any>>[]

    查找到的节点

  • off(type?: string, handler?: ((data: any) => any)): void
  • 注销事件

    memberof

    EventEmitter

    Parameters

    • Optional type: string
    • Optional handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    Returns void

    {void}

  • on(type: string, handler: ((data: any) => any), once?: boolean): void
  • 注册handler

    memberof

    EventEmitter

    Parameters

    • type: string
    • handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    • Optional once: boolean

    Returns void

  • removeChildren(...children: T[]): void
  • 删除1~n个字节点

    Parameters

    • Rest ...children: T[]

      待删除节点

    Returns void

  • removeEventListener(type?: string, handler?: ((data: any) => any), once?: boolean): void
  • 注销handler

    memberof

    EventEmitter

    Parameters

    • Optional type: string
    • Optional handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    • Optional once: boolean

    Returns void

  • removeFromParent(): void
  • 从父节点中删除自己

    Returns void

  • traverse(callback: ((n: T) => void), isIncludingSelf?: boolean): void
  • 遍历节点

    Parameters

    • callback: ((n: T) => void)

      回调函数

        • (n: T): void
        • Parameters

          • n: T

          Returns void

    • Optional isIncludingSelf: boolean

      自己是否执行回调函数,默认为true

    Returns void

Generated using TypeDoc