Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Node<In, Out>

The graph node has an input and output DataFrame

Usage

Creating a Node

Default nodes require you to specify the input and output data frame type. In general, nodes have the ability to process an input data frame and output a different (processed) data frame.

import { DataFrame, Node } from '@openhps/core';

export class CustomNode<In extends DataFrame, Out extends DataFrame> extends Node<In, Out> {
    // ...
}

Abstract implementations such as a SourceNode and SinkNode only take one input or output data frame type as they do not process or change the frame.

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

graph

graph: any

Graph shape

name

name: string

Name of the node. Does not have to be unique.

Protected options

options: NodeOptions

Node options

uid

uid: string = ...

Unique identifier of node.

Readonly Static captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Readonly Static errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Accessors

inlets

  • get inlets(): Inlet<In>[]

model

  • get model(): Model<any, any>
  • Graph this model is part of

    Returns Model<any, any>

    Positioning model

outlets

  • get outlets(): Outlet<Out>[]

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): Node<In, Out>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Node<In, Out>

emit

  • emit(name: string | symbol, ...args: any[]): boolean
  • emit(event: "available"): boolean
  • emit(name: "completed", e: PushCompletedEvent): boolean
  • emit(name: "error", e: PushError): boolean
  • emit(name: "ready"): boolean
  • emit(name: "destroy"): boolean

emitAsync

  • emitAsync(type: string | symbol, ...args: any[]): Promise<boolean>

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getOptions

isAvailable

  • isAvailable(): boolean
  • Check if the node is available for accepting push requests

    Returns boolean

    Is the node available to push

isReady

  • isReady(): boolean

listenerCount

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

    • type: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

logger

  • logger(level: string, log: any): void

off

  • off(event: string | symbol, listener: (...args: any[]) => void): Node<In, Out>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Node<In, Out>

on

  • on(name: string | symbol, listener: (...args: any[]) => void): Node<In, Out>
  • on(event: "available", listener: () => void | Promise<void>): Node<In, Out>
  • on(name: "completed", listener: (event: PushCompletedEvent) => void | Promise<void>): Node<In, Out>
  • on(name: "error", listener: (event: PushError) => void | Promise<void>): Node<In, Out>
  • on(name: "pull", listener: (options?: PullOptions) => void | Promise<void>): Node<In, Out>
  • on(name: "push", listener: (frame: In, options?: PushOptions) => void | Promise<void>): Node<In, Out>
  • Parameters

    • name: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Node<In, Out>

  • Event when a node is available

    Parameters

    • event: "available"

      available

    • listener: () => void | Promise<void>

      Event callback

        • (): void | Promise<void>
        • Returns void | Promise<void>

    Returns Node<In, Out>

  • Event when a push is completed

    Parameters

    Returns Node<In, Out>

  • Event when an error is triggered

    Parameters

    • name: "error"

      error

    • listener: (event: PushError) => void | Promise<void>

      Error event callback

        • Parameters

          Returns void | Promise<void>

    Returns Node<In, Out>

  • Event when a data frame is pulled

    Parameters

    • name: "pull"

      receive

    • listener: (options?: PullOptions) => void | Promise<void>

      Event callback

        • Parameters

          Returns void | Promise<void>

    Returns Node<In, Out>

  • Event when a data frame is push to the node

    Parameters

    • name: "push"

      receive

    • listener: (frame: In, options?: PushOptions) => void | Promise<void>

      Event callback

        • (frame: In, options?: PushOptions): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns Node<In, Out>

once

  • once(name: string | symbol, listener: (...args: any[]) => void): Node<In, Out>
  • once(event: "available", listener: () => void | Promise<void>): Node<In, Out>
  • once(name: "completed", listener: (event: PushCompletedEvent) => void | Promise<void>): Node<In, Out>
  • once(name: "destroy", listener: () => void | Promise<void>): Node<In, Out>
  • once(name: "build", listener: (builder: any) => void | Promise<void>): Node<In, Out>
  • once(name: "ready", listener: () => void | Promise<void>): Node<In, Out>
  • Parameters

    • name: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Node<In, Out>

  • Event when a node is available

    Parameters

    • event: "available"

      available

    • listener: () => void | Promise<void>

      Event callback

        • (): void | Promise<void>
        • Returns void | Promise<void>

    Returns Node<In, Out>

  • Event when a push is completed

    Parameters

    Returns Node<In, Out>

  • Event called when node is destroyed

    Parameters

    • name: "destroy"

      destroy

    • listener: () => void | Promise<void>

      Event callback

        • (): void | Promise<void>
        • Returns void | Promise<void>

    Returns Node<In, Out>

  • Event called when node is build

    Parameters

    • name: "build"

      build

    • listener: (builder: any) => void | Promise<void>

      Event callback

        • (builder: any): void | Promise<void>
        • Parameters

          • builder: any

          Returns void | Promise<void>

    Returns Node<In, Out>

  • Event called when node is ready

    Parameters

    • name: "ready"

      ready

    • listener: () => void | Promise<void>

      Event callback

        • (): void | Promise<void>
        • Returns void | Promise<void>

    Returns Node<In, Out>

onceAvailable

  • onceAvailable(): Promise<void>
  • Promise once the node is available

    Returns Promise<void>

    Promise when the node is available

onceCompleted

  • onceCompleted(frameUID: string): Promise<PushEvent>
  • Promise once the frame is completed

    Parameters

    • frameUID: string

      Frame UID

    Returns Promise<PushEvent>

    Promise when the frame is completed

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): Node<In, Out>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Node<In, Out>

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): Node<In, Out>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Node<In, Out>

pull

push

  • push(data: In | In[], options?: PushOptions): Promise<void>

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): Node<In, Out>
  • Parameters

    • Optional event: string | symbol

    Returns Node<In, Out>

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Node<In, Out>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Node<In, Out>

setMaxListeners

  • setMaxListeners(n: number): Node<In, Out>
  • Parameters

    • n: number

    Returns Node<In, Out>

setOptions

Static listenerCount

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

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>