Skip to content

Function: applySeeds()

ts
function applySeeds(container: Container, seeds: SeedEntries): void;

Defined in: src/wirestate-core/seeds/apply-seeds.ts:37

Adds targeted seed values to a container.

Parameters

ParameterTypeDescription
containerContainerContainer to update.
seedsSeedEntriesSeed entries to add.

Returns

void

Remarks

Targeted seeds are keyed by service class, string, or symbol. The existing seed map is updated in place so providers can add and remove their own entries without replacing everyone else's data.

Example

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

@Injectable()
class CounterService {}

const container = createContainer();

applySeeds(container, [
  [CounterService, { count: 10 }],
  ["API_URL", "https://api.example.com"],
]);