@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
39 lines (24 loc) • 1.29 kB
Markdown
---
lang: en
title: 'API docs: core.application.onstop'
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.application.onstop.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/core](./core.md) > [Application](./core.application.md) > [onStop](./core.application.onstop.md)
## Application.onStop() method
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.
<b>Signature:</b>
```typescript
onStop(fn: () => ValueOrPromise<void>): Binding<LifeCycleObserver>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fn | () => [ValueOrPromise](./context.valueorpromise.md)<!-- --><void> | The function to invoke, it can be synchronous (returning <code>void</code>) or asynchronous (returning <code>Promise<void></code>). |
<b>Returns:</b>
[Binding](./context.binding.md)<!-- --><[LifeCycleObserver](./core.lifecycleobserver.md)<!-- -->>
The LifeCycleObserver binding created.