Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LocalStorageDriver<I, T>

Type parameters

  • I

  • T

Hierarchy

  • DataServiceDriver<I, T>
    • LocalStorageDriver

Index

Constructors

constructor

  • new LocalStorageDriver<I, T>(dataType: () => T, namespace?: string): LocalStorageDriver<I, T>

Properties

Protected _indexKeys

_indexKeys: string[] = ...

dataType

dataType: () => T

Type declaration

    • (): T
    • Returns T

logger

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

Type declaration

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

      • level: string
      • log: any

      Returns void

model

model: ModelGraph<any, any>

name

name: string

Service name

namespace

namespace: string

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns LocalStorageDriver<I, T>

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
  • Parameters

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

    Returns boolean

  • Service ready

    Parameters

    • name: "ready"

      ready

    Returns boolean

  • Destroy the service

    Parameters

    • name: "destroy"

      destroy

    Returns boolean

emitAsync

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

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

    Returns Promise<boolean>

eventNames

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

findAll

  • findAll(query?: FilterQuery<T>): Promise<T[]>

findByUID

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

findOne

  • findOne(query?: FilterQuery<T>): Promise<T>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

insert

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

isReady

  • isReady(): boolean
  • Returns 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[]

off

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

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

          • Rest ...args: any[]

          Returns void

    Returns LocalStorageDriver<I, T>

on

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

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

          • Rest ...args: any[]

          Returns void

    Returns LocalStorageDriver<I, T>

once

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns LocalStorageDriver<I, T>

  • Event called when service is destroyed

    Parameters

    • name: "destroy"

      destroy

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

      Event callback

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

    Returns LocalStorageDriver<I, T>

  • Event called when service is build

    Parameters

    • name: "build"

      build

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

      Event callback

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

    Returns LocalStorageDriver<I, T>

  • Event called when service is ready

    Parameters

    • name: "ready"

      ready

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

      Event callback

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

    Returns LocalStorageDriver<I, T>

prependListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns LocalStorageDriver<I, T>

prependOnceListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns LocalStorageDriver<I, T>

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • Parameters

    • Optional event: string | symbol

    Returns LocalStorageDriver<I, T>

removeListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns LocalStorageDriver<I, T>

setMaxListeners

  • Parameters

    • n: number

    Returns LocalStorageDriver<I, T>

Static listenerCount

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

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number