Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ServiceRegistryImpl

Mutable registry of service implementations, bound to a service definitions.

Hierarchy

  • ServiceRegistryImpl

Implements

Index

Properties

Methods

Properties

Private Readonly listeners

listeners: ServiceRegistryListener[] = []

Listeners, to be notified whenever a new service implementation is added

Private Readonly services

services: Map<ServiceDefinition<any, any>, Service<any, any>> = new Map<ServiceDefinition<any, any>, Service<any, any>>()

The map of services indexed by their service definition

Methods

add

  • add<Request, Response>(definition: ServiceDefinition<Request, Response>, service: Service<Request, Response>): void
  • Add a new service implementation to the registry. Only one service may be bound to a given definition.

    When a new service is added, any listeners will be notified.

    throws

    a RuntimeError if another service is already bound to the same definition.

    Type parameters

    • Request

    • Response

    Parameters

    • definition: ServiceDefinition<Request, Response>

      the service definition

    • service: Service<Request, Response>

      the service implementation

    Returns void

addListener

  • Add a listener, to be notified whenever a new service implementation is added.

    When a listener is added, it will immediately be called with all existing services in the registry.

    Listeners are used to add services to the ServiceAdapter

    throws

    a RuntimeError the registry contains duplicate service definitions.

    Parameters

    Returns void

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.