Skip to content

Function: OnActivated()

ts
function OnActivated(): MethodDecorator;

Defined in: src/wirestate-core/service/on-activated.ts:35

Runs a service method after container activation.

Returns

MethodDecorator

Method decorator.

Remarks

Activation happens the first time the singleton service is resolved.

Use it for seed reads, subscriptions, and startup work. A service hierarchy may have one activation hook name.

Example

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

@Injectable()
class FeedService {
  @OnActivated()
  public onActivated(): void {
    this.initializeFromSeed();
  }
}