Skip to content

Function: OnDeprovision()

ts
function OnDeprovision(): MethodDecorator;

Defined in: src/wirestate-core/service/on-deprovision.ts:37

Runs before a framework provider stops exposing the container.

Returns

MethodDecorator

Method decorator.

Remarks

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

Use it to clean up work started by @OnProvision. A service 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();
  }
}