Options
All
  • Public
  • Public/Protected
  • All
Menu

The base node which everything inherits from.

Hierarchy

Implements

Index

Constructors

constructor

Properties

$

$: object

An object for any miscellanous user data.

Type declaration

  • [index: string]: any

_

_: object

An object for any miscellanous user data.

Type declaration

  • [index: string]: any

children

children: Node[]

Array of node's children.

data

data: object

An object for any miscellanous user data.

Type declaration

  • [index: string]: any

focusable

focusable: boolean

index

index: number

Render index (document order index) of the last render call.

lpos

options

options: INodeOptions

Original options object.

Optional parent

parent: Node

Parent node. If null it means the element is not attached to any screen or program, or the node is a Screen.

screen

screen: Screen

Parent screen.

type

type: string

Type of the node (e.g. box).

uid

uid: number

Unique identifier for Node instances. @internal

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

append

  • append(node: Node): void

collectAncestors

  • collectAncestors(s?: boolean): void

collectDescendants

  • collectDescendants(s?: boolean): void

destroy

  • destroy(): void
  • detach() this node from its parent, and will also detach and destroy each of its descendant nodes each of them emitting [[destory]] event also.

    Returns void

detach

  • detach(): void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

emitAncestors

  • emitAncestors(): void

emitDescendants

  • emitDescendants(type?: string, ...args: any[]): void
  • Emit event for element, and recursively emit same event for all descendants. If s is provided it will call [[iter]] on self first.

    Parameters

    • Optional type: string
    • Rest ...args: any[]

    Returns void

eventNames

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

forAncestors

  • forAncestors(iter: function, s?: boolean): void
  • Parameters

    • iter: function
        • (node: Node): void
        • Parameters

          Returns void

    • Optional s: boolean

    Returns void

forDescendants

  • forDescendants(iter: function, s?: boolean): void
  • Visit each node's descendants, with [[iter]] function, parents first. If s is provided it will call [[iter]] on self first.

    Parameters

    • iter: function
        • (node: Node): void
        • Parameters

          Returns void

    • Optional s: boolean

    Returns void

free

  • free(): void

get

  • get<T>(name: string, def: T): T
  • Get user property with a potential default value.

    Type parameters

    • T

    Parameters

    • name: string
    • def: T

    Returns T

getMaxListeners

  • getMaxListeners(): number
  • Returns number

hasAncestor

hasDescendant

insert

  • insert(node: Node, index: number): void
  • Insert a node to this node's children at index i.

    Parameters

    • node: Node
    • index: number

    Returns void

insertAfter

  • insertAfter(node: Node, refNode: Node): void
  • Insert a node from node after the reference node.

    Parameters

    Returns void

insertBefore

  • insertBefore(node: Node, refNode: Node): void
  • Insert a node to this node's children before the reference node.

    Parameters

    Returns void

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "reparent", listener: function): void
  • on(event: "adopt", listener: function): void
  • on(event: "attach", listener: function): void
  • on(event: "detach", listener: function): void
  • on(event: "remove", listener: function): void
  • on(event: string, listener: function): this
  • Received when node gains a new parent. If the node was detached from the sreen, newParent will be undefined.

    Parameters

    • event: "reparent"
    • listener: function
        • (this: this, newParent?: Node): void
        • Parameters

          • this: this
          • Optional newParent: Node

          Returns void

    Returns void

  • emitted by a parent node when adding a new chhild node.

    Parameters

    • event: "adopt"
    • listener: function
        • (this: this, newChildren: Node): void
        • Parameters

          • this: this
          • newChildren: Node

          Returns void

    Returns void

  • Parameters

    • event: "attach"
    • listener: function
        • (this: this, newParent: Node): void
        • Parameters

          • this: this
          • newParent: Node

          Returns void

    Returns void

  • Emitted by a node that is being detached frmo the screen or ancester.

    Parameters

    • event: "detach"
    • listener: function
        • (this: this, newParent: Node): void
        • Parameters

          • this: this
          • newParent: Node

          Returns void

    Returns void

  • Triggered by a parent node when removing a child node

    Parameters

    • event: "remove"
    • listener: function
        • (this: this, removedChild: Node): void
        • Parameters

          • this: this
          • removedChild: Node

          Returns void

    Returns void

  • Parameters

    • event: string
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prepend

  • prepend(node: Node): void
  • Prepend a node to this node's children.

    Parameters

    Returns void

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

remove

  • remove(node: Node): void

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

set

  • set(name: string, value: any): void
  • Set user property to value.

    Parameters

    • name: string
    • value: any

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc