Page Contents

Home > @loopback/core > LifeCycleObserverRegistry

LifeCycleObserverRegistry class

A context-based registry for life cycle observers

Signature:

export declare class LifeCycleObserverRegistry implements LifeCycleObserver 

Implements: LifeCycleObserver

Constructors

Constructor Modifiers Description
(constructor)(context, observersView, options)   Constructs a new instance of the LifeCycleObserverRegistry class

Properties

Property Modifiers Type Description
context <p>protected</p><p>readonly</p> Context  
observersView <p>protected</p><p>readonly</p> ContextView<LifeCycleObserver>  
options <p>protected</p><p>readonly</p> LifeCycleObserverOptions  

Methods

Method Modifiers Description
getObserverGroup(binding) protected Get the group for a given life cycle observer binding
getObserverGroupsByOrder()   Get observer groups ordered by the group
init()   Notify all life cycle observers by group of init
invokeObserver(observer, event) protected Invoke an observer for the given event
notifyGroups(events, groups, reverse) protected Emit events to the observer groups
notifyObservers(observers, bindings, event) protected Notify an observer group of the given event
setOrderedGroups(groups)    
sortObserverBindingsByGroup(bindings) protected Sort the life cycle observer bindings so that we can start/stop them in the right order. By default, we can start other observers before servers and stop them in the reverse order
start()   Notify all life cycle observers by group of start
stop()   Notify all life cycle observers by group of stop