Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SinkNode<In>

Sink node

Usage

Creating a SinkNode

When creating a sink node, you have to implement an onPush method that provides you with the pushed data frame. Sink nodes are the final nodes in the model and have no outlets. Once the onPush is resolved, data objects in that frame are stored in a DataObjectService.

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

export class CustomSink<In extends DataFrame> extends SinkNode<In> {
    // ...
    public onPush(data: In, options?: GraphOptions): Promise<void> {
        return new Promise<void>((resolve, reject) => {

        });
    }
}

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

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): SinkNode<In>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns SinkNode<In>

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

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): SinkNode<In>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns SinkNode<In>

on

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

Abstract onPush

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

once

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

onceAvailable

  • onceAvailable(): Promise<void>

onceCompleted

  • onceCompleted(frameUID: string): Promise<PushEvent>

Protected persistDataObject

  • persistDataObject(frame: In): Promise<void>

prependListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns SinkNode<In>

prependOnceListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns SinkNode<In>

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): SinkNode<In>
  • Parameters

    • Optional event: string | symbol

    Returns SinkNode<In>

removeListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns SinkNode<In>

setMaxListeners

  • setMaxListeners(n: number): SinkNode<In>

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[]>