Skip to main content
Listens for plugin lifecycle changes. When the host emits a lifecycle event, it calls listener.onMsg(msg), where msg.state is the state value.
This API depends on the internal event channel registered by init(). Call PluginManager.init() first, then register the lifecycle listener.
Parameters Returns
  • PluginEventSubscription: subscription object. Call remove() to unregister the listener
Notes
  • The callback receives the event data, not the full original message. Use msg.state to determine the current lifecycle state
  • If the listener is registered after the event arrives, and the most recent lifecycle event is still within 1 second, that last event is delivered immediately so the listener does not miss it

Lifecycle States

Example