Skip to main content

GenericExternalService

A generic external service providing external resources.

GenericExternalService provides an implementation of ExternalService for external resources by lifting the open and close operations from ExternalResource to the subscribe and unsubscribe operations required by ExternalService.

Implements

  • ExternalService

Constructors

new GenericExternalService()

new GenericExternalService(resources): GenericExternalService

Parameters

ParameterTypeDescription
resources{}Association of resource names to ExternalResources.

Returns

GenericExternalService

Methods

shutdown()

shutdown(): void

Shutdown the external service.

Returns

void

Implementation of

ExternalService.shutdown

subscribe()

subscribe(
resourceName,
params,
callbacks): void

Subscribe to a resource provided by the external service.

Parameters

ParameterTypeDescription
resourceNamestring-
paramsJsonParameters of the external resource.
callbacks{ error: (error) => void; loading: () => void; update: (updates, isInit) => void; }Callbacks to react on error/loading/update.
callbacks.error(error) => voidError callback.
callbacks.loading() => voidLoading callback.
callbacks.update(updates, isInit) => voidUpdate callback.

Returns

void

Implementation of

ExternalService.subscribe

unsubscribe()

unsubscribe(resourceName, params): void

Unsubscribe from a resource provided by the external service.

Parameters

ParameterTypeDescription
resourceNamestring-
paramsJsonParameters of the external resource.

Returns

void

Implementation of

ExternalService.unsubscribe