The object event dispatcher collects all object events from one.core and reemits them in a controlled fashion.

  • calls are serialized
  • the interface is much more puwerful than that of one.core
  • statistics make it much easier to debug stuff

Constructors

Properties

determinePriorityOverride: undefined | ((result: AnyObjectResult) => number)

The application can override the priority values for results that are enqueued by setting a function here.

Lesser values will result in a higher priority.

The result value that shall be enqueued.

enableEnqueueFiltering: boolean = true

This option discards objects for which nobody listens before they are pushed to the buffer.

This might have the drawback that if an object in the buffer causes a new event listener to be registered, the new event listener will miss such objects. This might not be a problem at the moment, because such objects will already be on disk (That's why it is enabled by default).

enableIOCallStatistics: boolean = false

If true, then I/O call statistics are recorded during handler execution.

Note that this might accumulate a lot of data and reduce performance.

enableStatistics: boolean = true

If disabled no statistics except the global statistics are computed.

Global statistics ar the global event counters.

maxExecutionStatisticsPerHandler: number = 10

How many execution statistics per callback are stored.

-1 means unlimited, which will result in a serious memory leak.

maxProcessedObjectCount: number = 10

Number of processed object information to retain.

-1 means unlimited, which will result in a serious memory leak.

onError: OEvent<((err: any) => void)> = ...
onGlobalStatisticChanged: OEvent<(() => void)> = ...
onPauseStateChanged: OEvent<((paused: boolean) => void)> = ...
retainDeregisteredHandlers: boolean = false

If true this will retain all handler that have been deregistered.

This is useful to keep track of temporary callbacks (like the ones used in react views)

Accessors

Methods

  • Get handler that are registered for this result.

    Note: Somehow the as casts are needed, because typescript does not recognize, that a VersionedObjectResult always leads to an Array of HandlerInfo and so on for unversioned and Id ... That is why the 'as' casts are needed.

    This is public by intention. The ui needs it to visualize handlers for pending objects.

    Type Parameters

    • T extends UnversionedObjectResult<OneUnversionedObjectTypes> | VersionedObjectResult<OneVersionedObjectTypes> | IdObjectResult<OneIdObjectTypes>

    Parameters

    • result: T

    Returns HandlerInfo<T>[]

  • Load all settings from localStorage.

    If no settings are present - use sensible defaults.

    Returns Promise<void>

  • Type Parameters

    • T extends (keyof OneVersionedObjectInterfaces) | "*"

    Parameters

    • cb: ((result: IdObjectResult<OneVersionedObjectInterfaces[OneVersionedObjectTypeNamesOrStar<T>]>) => void | Promise<void>)
        • (result): void | Promise<void>
        • Parameters

          • result: IdObjectResult<OneVersionedObjectInterfaces[OneVersionedObjectTypeNamesOrStar<T>]>

          Returns void | Promise<void>

    • description: string
    • type: "*" | T = '*'

    Returns (() => void)

      • (): void
      • Returns void

  • Type Parameters

    • T extends (keyof OneVersionedObjectInterfaces) | "*"

    Parameters

    • cb: ((result: VersionedObjectResult<OneVersionedObjectInterfaces[OneVersionedObjectTypeNamesOrStar<T>]>) => void | Promise<void>)
        • (result): void | Promise<void>
        • Parameters

          • result: VersionedObjectResult<OneVersionedObjectInterfaces[OneVersionedObjectTypeNamesOrStar<T>]>

          Returns void | Promise<void>

    • description: string
    • type: "*" | T = '*'
    • idHash: "*" | SHA256IdHash<OneVersionedObjectInterfaces[OneVersionedObjectTypeNamesOrStar<T>]> = '*'

    Returns (() => void)

      • (): void
      • Returns void

  • Type Parameters

    • T extends (keyof OneUnversionedObjectInterfaces) | "*"

    Parameters

    • cb: ((result: UnversionedObjectResult<OneUnversionedObjectInterfaces[OneUnversionedObjectTypeNamesOrStar<T>]>) => void | Promise<void>)
        • (result): void | Promise<void>
        • Parameters

          • result: UnversionedObjectResult<OneUnversionedObjectInterfaces[OneUnversionedObjectTypeNamesOrStar<T>]>

          Returns void | Promise<void>

    • description: string
    • type: "*" | T = '*'

    Returns (() => void)

      • (): void
      • Returns void