@threadplane/angularFunctionv0.3.7

createAgentRef

Creates a typed agent handle.

import { createAgentRef } from '@threadplane/angular';

Declaration · overload 1

export declare function createAgentRef<TSession extends AgentSessionLike = AgentSession>(debugName?: string): AgentRef<TSession>;

Type parameters

Parameters

debugName · optional
string

Optional name shown in Angular injection errors and in the warning about several refs at one injector level.

Returns

AgentRef<TSession>

Examples

export const TRIP = createAgentRef<TripSession>('trip');
// app.config.ts: provideAgent(TRIP, { createSession: … })
// component:     const agent = injectAgent(TRIP); // Agent<TripSession>