Pluggable
Base class for objects that can have plugins attached.
Provides plugin attachment capabilities and lifecycle management. Plugins are attached during configuration and initialized during startup. Not constructed directly, the host is a SeedcordSeedcord.
class Pluggable<
TPluggableEvents extends SEEventMapLike<TPluggableEvents> =
SENoEvents
> extends StrictEventEmitter<TPluggableEvents>class Pluggable<
TPluggableEvents extends SEEventMapLike<TPluggableEvents> =
SENoEvents
> extends StrictEventEmitter<TPluggableEvents>Member visibility
Filter class members by access level.
Pluggable(shutdown: CoordinatedShutdown, startup: CoordinatedStartup)Pluggable(shutdown: CoordinatedShutdown, startup: CoordinatedStartup)Showing members with Protected visibility and higher.
Properties
Methods
TPluggableEvents
TPluggableEvents extends SEEventMapLike<TPluggableEvents> = SENoEventsTPluggableEvents extends SEEventMapLike<TPluggableEvents> = SENoEventsprotected readonly shutdown: CoordinatedShutdownprotected readonly shutdown: CoordinatedShutdownprotected readonly startup: CoordinatedStartupprotected readonly startup: CoordinatedStartupAttaches a plugin to this instance
Plugins provide external functionality and are initialized during the specified startup phase. The plugin instance becomes available as a property in corecore wherever it's available.
Make sure to augment the CoreCore interface with the plugin type to ensure TypeScript recognizes it and provides intellisense.
public attach<Key, Ctor>(
this: this,
key: Key,
Plugin: Ctor,
startupPhase: StartupPhase,
args: PluginArgs<Ctor>
): this & Record<Key, InstanceType<Ctor>>public attach<Key, Ctor>(
this: this,
key: Key,
Plugin: Ctor,
startupPhase: StartupPhase,
args: PluginArgs<Ctor>
): this & Record<Key, InstanceType<Ctor>>keyProperty name to access the plugin instance
PluginPlugin constructor class
startupPhaseWhen during startup to initialize this plugin (StartupPhaseStartupPhase)
argsAdditional arguments to pass to the plugin constructor
KeyThe property name for accessing the plugin
CtorThe plugin constructor type
Throws:
A SeedcordError When called after initialization or if key already exists