Skip to content
Classhttpv0.11.0

Plugin

Base class for an HTTP plugin, binding this.core to the HTTP Core.

A plugin that runs on either transport extends the base from @seedcord/core/plugin, whose this.core is typed to the shared members only.

abstract class Plugin<
    Opts extends HttpPluginOptions = { transport: "http" }
> extends Plugin<
    Opts,
    Core,
    keyof typeof HTTP_SCOPE
>

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the Plugin class

Plugin(
    host: CoreBase,
    [spec],
    input: PluginSpecArgs<Opts, Fixed>
)

Inherited from:Plugin

Showing members with Protected visibility and higher.

Opts

The transport and runtime the plugin declares.

Opts extends HttpPluginOptions = { transport: 'http'; }

core

The host, typed to the transport whose Plugin base this class extends.

protected core: TCore

Inherited from:Plugin

logger

Logs under the plugin's class name, on the channel its attach key sets.

protected readonly logger: Logger

Inherited from:Plugin

dispose()

Runs during teardown, in ShutdownPhase.Disconnect by default. seedcord skips it when init() has thrown.

When init() outlasts its timeout, seedcord calls this once that init() resolves, outside any shutdown phase. The process must still be alive for that call to happen.

async dispose?(): Promise<void>

Inherited from:Plugin

ready()

Runs in the Ready phase, after every attached plugin's init() has resolved. The other Ready tasks run alongside it, including the http server binding its port.

Override it when your work needs a logged-in client or a resolved application id.

async ready?(): Promise<void>

Inherited from:Plugin

registerCriticalFiles()

Registers critical file patterns that should trigger a full restart when changed in Dev HMR.

protected registerCriticalFiles(
    patterns: string[]
): void
Parameter: patterns

Glob patterns. A relative one resolves against root from seedcord.config.ts.

Inherited from:Plugin

rejectOptions()

Rejects the options this plugin got.

protected rejectOptions(reason: string): never
Parameter: reason

Why the options are invalid.

Throws:

A SeedcordTypeError every time, with the plugin class name and reason in its message.

Inherited from:Plugin