MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / onStop

Method onStop

packages/core/src/application.ts:424–433  ·  view source on GitHub ↗

* Register a function to be called when the application starts. * * This is a shortcut for adding a binding for a LifeCycleObserver * implementing a `start()` method. * * @param fn The function to invoke, it can be synchronous (returning `void`) * or asynchronous (returning `Promis

(fn: () => ValueOrPromise<void>)

Source from the content-addressed store, hash-verified

422 * @returns The LifeCycleObserver binding created.
423 */
424 public onStop(fn: () => ValueOrPromise<void>): Binding<LifeCycleObserver> {
425 const key = [
426 CoreBindings.LIFE_CYCLE_OBSERVERS,
427 fn.name || '<onStop>',
428 generateUniqueId(),
429 ].join('.');
430 return this.bind<LifeCycleObserver>(key)
431 .to({stop: fn})
432 .apply(asLifeCycleObserver);
433 }
434
435 private async getLifeCycleObserverRegistry() {
436 return this.get(CoreBindings.LIFE_CYCLE_OBSERVER_REGISTRY);

Callers 1

Calls 3

applyMethod · 0.80
toMethod · 0.80
bindMethod · 0.45

Tested by

no test coverage detected