# Pluggable

`class` in `seedcord` · v0.14.0

<https://docs.seedcord.org/packages/seedcord/0.14.0/classes/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 [`Seedcord`](/packages/seedcord/0.14.0/classes/seedcord).

```ts
class Pluggable<
    TPluggableEvents extends SEEventMapLike<TPluggableEvents> =
        SENoEvents
> extends StrictEventEmitter<TPluggableEvents>
```

## Constructors

### constructor

```ts
Pluggable(shutdown: CoordinatedShutdown, startup: CoordinatedStartup)
```

Constructs a new instance of the `Pluggable` class

## Properties

### isInitialized

```ts
protected isInitialized: boolean
```

### plugins

```ts
protected readonly plugins: Plugin[]
```

### shutdown

```ts
protected readonly shutdown: CoordinatedShutdown
```

### startup

```ts
protected readonly startup: CoordinatedStartup
```

## Methods

### attach

```ts
public attach<Key, Ctor>(
    this: this,
    key: Key,
    Plugin: Ctor,
    startupPhase: StartupPhase,
    args: PluginArgs<Ctor>
): this & Record<Key, InstanceType<Ctor>>
```

Attaches 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 `core` wherever it's available.

Make sure to augment the [`Core`](/packages/seedcord/0.14.0/interfaces/core) interface with the plugin type to ensure TypeScript recognizes it and provides intellisense.
