Docs (4.0.0)
class Service method

observeService

Observes another service by ID, until the current service is unlinked.

protected

protected observeService<TService extends Service>(id: string, observer?: Observer<TService> | ManagedObject.AttachObserverFunction<TService>): Observer<TService>

Parameters

  • id — The ID of the service to be observed
  • observer — An Observer class or instance, or a function that’s called whenever a change event is emitted by the target service (with service and event arguments, respectively), and when the target service is unlinked (without any arguments)

Return value

The observer instance, which references the observed service using the observed property

Related

  • class Service abstractAn abstract class that represents a named service.