or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-8/

Invocation Control Toolkit

Utilities that wrap business actions so they respect burst control, single-run setup, cached lookups, and deferred execution.

Capabilities

Burst-safe notifier

  • First trigger executes immediately; further triggers within the quiet window only schedule one trailing send that uses the most recent payload. @test
  • A pending trailing send can be canceled so only completed sends happen. @test

One-time setup

  • A setup routine runs at most once; later invocations return the original resolved value without rerunning. @test

Cached lookup

  • Repeated requests for the same key reuse the first computed value, while distinct keys compute independently; an optional key formatter groups equivalent keys. @test

Deferred execution

  • A helper schedules a function to run after a specified delay while forwarding provided arguments. @test

Implementation

@generates

API

export type AsyncMaybe<T> = T | Promise<T>;

export type Notifier<TPayload> = {
  trigger(payload: TPayload): void;
  cancel(): void;
};

export function createBurstNotifier<TPayload>(
  send: (payload: TPayload) => AsyncMaybe<void>,
  quietWindowMs: number
): Notifier<TPayload>;

export function createOneTimeSetup<T>(setup: () => AsyncMaybe<T>): () => Promise<T>;

export function createCachedLookup<TKey, TValue>(
  lookup: (key: TKey) => AsyncMaybe<TValue>,
  makeKey?: (key: TKey) => string
): {
  get(key: TKey): Promise<TValue>;
};

export function deferCall<TResult>(
  fn: (...args: any[]) => AsyncMaybe<TResult>,
  delayMs: number,
  ...args: any[]
): void;

Dependencies { .dependencies }

lodash { .dependency }

Provides call-frequency control, memoization, and deferred invocation utilities.