PluginContext
Source setup context shared by embedded and standalone execution.
You are reading the v8 docsDev
InterfaceTypeScript@discord-player/plugin-host
View sourcepackages/plugin-host/src/plugins/types.ts:209interface PluginContext<Options>Source setup context shared by embedded and standalone execution.
Properties
optionsreadonly
readonly options: OptionsOptions belonging to this registration.
signalreadonly
readonly signal: AbortSignalRegistration lifetime signal.
playerreadonly
readonly player: LegacyPlayerContextStructural source context hosting this registration.
Methods
on
on<K extends keyof OperationMap>(
operation: K,
handler: OperationHandler<K>,
options?: HandlerOptions,
): () => voidRegister an owned operation handler.
Parameters
| Name | Type | Description |
|---|---|---|
| operation | K | Operation name. |
| handler | OperationHandler<K> | Typed implementation. |
| options? | HandlerOptions | Ordering and routing metadata. |
Returns
() => void
An idempotent subscription removal function.
provide
provide<K extends "playback.backend">(
capability: K,
implementation: ProviderMap[K],
): voidSupply one locally owned implementation of a declared singleton capability.
Parameters
| Name | Type | Description |
|---|---|---|
| capability | K | Provider capability declared by the embedding Player. |
| implementation | ProviderMap[K] | Registration-owned implementation. |
Returns
void