Discord Player

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:209
interface PluginContext<Options>

Source setup context shared by embedded and standalone execution.

Properties

optionsreadonly

readonly options: Options

Options belonging to this registration.

signalreadonly

readonly signal: AbortSignal

Registration lifetime signal.

playerreadonly

readonly player: LegacyPlayerContext

Structural source context hosting this registration.

Methods

on

on<K extends keyof OperationMap>(
  operation: K,
  handler: OperationHandler<K>,
  options?: HandlerOptions,
): () => void

Register an owned operation handler.

Parameters

NameTypeDescription
operationK

Operation name.

handlerOperationHandler<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],
): void

Supply one locally owned implementation of a declared singleton capability.

Parameters

NameTypeDescription
capabilityK

Provider capability declared by the embedding Player.

implementationProviderMap[K]

Registration-owned implementation.

Returns

void

onCleanup

onCleanup(callback: () => void | Promise<void>): void

Register cleanup, run in reverse order after active handlers settle.

Parameters

NameTypeDescription
callback() => void | Promise<void>

Resource cleanup.

Returns

void

On this page