# Plugin

`class` in `gateway` · v0.1.0-next.3

<https://docs.seedcord.org/packages/gateway/0.1.0-next.3/classes/plugin>

Base class for Seedcord plugins

Extend this class to create plugins that integrate with the Seedcord lifecycle. Plugins have access to the core instance and must implement initialization logic.

```ts
abstract class Plugin<
    TPluginEvents extends EventMap<TPluginEvents> = NoEvents
>
    extends TypedEventEmitter<TPluginEvents>
    implements Initializeable, HmrAware
```

## Constructors

### constructor

```ts
Plugin(pluggable: Core)
```

Constructs a new instance of the `Plugin` class

## Properties

### logger

```ts
public abstract logger: Logger
```

### name

```ts
public name: string
```

### pluggable

```ts
protected pluggable: Core
```

## Methods

### init

```ts
public abstract async init(): Promise<void>
```

### onHmr

```ts
public async onHmr(_event: HmrUpdateEvent): Promise<void>
```

Reloads plugin state on an HMR update. The base implementation is a no-op, override it in your plugin.

### registerCriticalFiles

```ts
protected registerCriticalFiles(
    patterns: string[]
): void
```

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