Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataService<I, T>

DataService

Usage

Finding a DataService

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

export class CustomNode extends Node<DataFrame> {
    // Data services can be found in any function inside a node
    // that is added to a model
    public functionInsideNode(): void {
        // Get a service by its type
        let service = this.model.findDataService(DataObject);
        let service = this.model.findDataServiceByName("DataObject");
    }
}

Type parameters

  • I

  • T

Hierarchy

Index

Constructors

constructor

Properties

dataType

dataType: new () => T

Type declaration

    • new (): T
    • Returns T

Protected driver

driver: DataServiceDriver<I, T>

logger

logger: (level: string, log: any) => void = ...

Type declaration

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

      • level: string
      • log: any

      Returns void

name

name: string

Service name

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.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): DataService<I, T>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns DataService<I, T>

count

createIndex

  • createIndex(index: string): Promise<void>

delete

  • delete(id: I): Promise<void>

deleteAll

  • deleteAll(): Promise<void>

emit

  • emit(name: string | symbol, ...args: any[]): boolean
  • emit(name: "ready"): boolean
  • emit(name: "destroy"): boolean

emitAsync

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

eventNames

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

findAll

findByUID

  • findByUID(uid: I): Promise<T>

findOne

getMaxListeners

  • getMaxListeners(): number

insert

  • insert(id: I, object: T): Promise<T>

isReady

  • isReady(): boolean

listenerCount

  • listenerCount(type: string | symbol): number

listeners

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

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): DataService<I, T>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns DataService<I, T>

on

  • on(event: string | symbol, listener: (...args: any[]) => void): DataService<I, T>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns DataService<I, T>

once

  • once(name: string | symbol, listener: (...args: any[]) => void): DataService<I, T>
  • once(name: "destroy", listener: () => void | Promise<void>): DataService<I, T>
  • once(name: "build", listener: () => void | Promise<void>): DataService<I, T>
  • once(name: "ready", listener: () => void | Promise<void>): DataService<I, T>

prependListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns DataService<I, T>

prependOnceListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns DataService<I, T>

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): DataService<I, T>

removeListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns DataService<I, T>

setMaxListeners

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