Skip to content

Function: OnDeprovision()

ts
function OnDeprovision(): LifecycleDecorator;

Defined in: src/wirestate-core/provision/on-deprovision.ts:44

Runs before a framework provider stops exposing the container.

Returns

LifecycleDecorator

Method decorator.

Remarks

React and Lit providers call this when a container leaves a UI subtree. This is provider lifetime, not instance lifetime.

Use it to clean up work started by @OnProvision. A class hierarchy may have one deprovision hook name.

Example

typescript
import { Injectable, OnDeprovision } from "@wirestate/core";

@Injectable()
class PanelService {
  @OnDeprovision()
  public onDeprovision(): void {
    this.stopPolling();
    this.disconnect();
  }
}