Page Contents

Home > @loopback/core > Application > state

Application.state property

Get the state of the application. The initial state is created and it can transition as follows by start and stop:

  1. start - !started -> starting -> started - started -> started (no-op) 2. stop - (started | initialized) -> stopping -> stopped - ! (started || initialized) -> stopped (no-op)

Two types of states are expected: - stable, such as started and stopped - in process, such as booting and starting

Operations such as start and stop can only be called at a stable state. The logic should immediately set the state to a new one indicating work in process, such as starting and stopping.

Signature:

get state(): string;