Get if this discovery has been destroyed.
Event emitted whenever a service is detected as available.
Event called whenever this discovery is destroyed.
Event emitted when an error occurs for this discovery.
Event emitted whenever a service is detected to be unavailable.
Event emitted when a service is available and is updated.
Get a copy of the current services.
Merge this discovery with another instance that provides compatible
services. Services will be merged using their id
.
Destroy this discovery. This should be called whenever the discovery is no longer needed. Destroying a discovery will ensure that no more events are triggered and that resources used by the discovery are released.
Filter the services discovered. This creates a new instance in which only services that pass the predicate function are available.
The filtered discovery is only valid as long as this discovery is not
destroyed. Calling destroy()
on this discovery will destroy the
filtered discovery.
true
the
service will be available in the filtered resultsFind the first service that match the given predicate. Will return
the service or undefined
.
Find all of the services that match the given predicate. Will return an array with all of the matching services.
Get a service using an identifier. Will return the service or
undefined
.
Map services returned by this discovery into another type of service.
The mapped discovery is only valid as long as this discovery is not
destroyed. Calling destroy()
on this discovery will destroy the
mapped discovery.
Release the resources used by this discovery, without destroying discoveries it depends on.
This will mark this discovery as destroyed.
Generated using TypeDoc
Extension to
ServiceDiscovery
that supports releasing its resources.destroy()
is designed so that a discovery that depends on other discoveries, such as filtered discoveries, destroy the discoveries they depend on. This is to make it easier to create filtered and mapped chains and then ignore the root discovery.In some cases you want to keep the original discoveries around, in which case you can call
release()
to destroy only this discovery and not the ones it depends on.