@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
316 lines (143 loc) • 4.84 kB
Markdown
---
lang: en
title: 'API docs: core.lifecycleobserverregistry'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/core
permalink: /doc/en/lb4/apidocs.core.lifecycleobserverregistry.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/core](./core.md) > [LifeCycleObserverRegistry](./core.lifecycleobserverregistry.md)
## LifeCycleObserverRegistry class
A context-based registry for life cycle observers
**Signature:**
```typescript
export declare class LifeCycleObserverRegistry implements LifeCycleObserver
```
**Implements:** [LifeCycleObserver](./core.lifecycleobserver.md)
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[(constructor)(context, observersView, options)](./core.lifecycleobserverregistry._constructor_.md)
</td><td markdown="1">
</td><td markdown="1">
Constructs a new instance of the `LifeCycleObserverRegistry` class
</td></tr>
</tbody></table>
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[context](./core.lifecycleobserverregistry.context.md)
</td><td markdown="1">
`protected`
`readonly`
</td><td markdown="1">
[Context](./context.context.md)
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[observersView](./core.lifecycleobserverregistry.observersview.md)
</td><td markdown="1">
`protected`
`readonly`
</td><td markdown="1">
[ContextView](./context.contextview.md)<!-- --><[LifeCycleObserver](./core.lifecycleobserver.md)<!-- -->>
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[options](./core.lifecycleobserverregistry.options.md)
</td><td markdown="1">
`protected`
`readonly`
</td><td markdown="1">
[LifeCycleObserverOptions](./core.lifecycleobserveroptions.md)
</td><td markdown="1">
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[getObserverGroup(binding)](./core.lifecycleobserverregistry.getobservergroup.md)
</td><td markdown="1">
`protected`
</td><td markdown="1">
Get the group for a given life cycle observer binding
</td></tr>
<tr><td markdown="1">
[getObserverGroupsByOrder()](./core.lifecycleobserverregistry.getobservergroupsbyorder.md)
</td><td markdown="1">
</td><td markdown="1">
Get observer groups ordered by the group
</td></tr>
<tr><td markdown="1">
[init()](./core.lifecycleobserverregistry.init.md)
</td><td markdown="1">
</td><td markdown="1">
Notify all life cycle observers by group of `init`
</td></tr>
<tr><td markdown="1">
[invokeObserver(observer, event)](./core.lifecycleobserverregistry.invokeobserver.md)
</td><td markdown="1">
`protected`
</td><td markdown="1">
Invoke an observer for the given event
</td></tr>
<tr><td markdown="1">
[notifyGroups(events, groups, reverse)](./core.lifecycleobserverregistry.notifygroups.md)
</td><td markdown="1">
`protected`
</td><td markdown="1">
Emit events to the observer groups
</td></tr>
<tr><td markdown="1">
[notifyObservers(observers, bindings, event)](./core.lifecycleobserverregistry.notifyobservers.md)
</td><td markdown="1">
`protected`
</td><td markdown="1">
Notify an observer group of the given event
</td></tr>
<tr><td markdown="1">
[setOrderedGroups(groups)](./core.lifecycleobserverregistry.setorderedgroups.md)
</td><td markdown="1">
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[sortObserverBindingsByGroup(bindings)](./core.lifecycleobserverregistry.sortobserverbindingsbygroup.md)
</td><td markdown="1">
`protected`
</td><td markdown="1">
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
</td></tr>
<tr><td markdown="1">
[start()](./core.lifecycleobserverregistry.start.md)
</td><td markdown="1">
</td><td markdown="1">
Notify all life cycle observers by group of `start`
</td></tr>
<tr><td markdown="1">
[stop()](./core.lifecycleobserverregistry.stop.md)
</td><td markdown="1">
</td><td markdown="1">
Notify all life cycle observers by group of `stop`
</td></tr>
</tbody></table>