# FolderExports

`class` in `core` · v0.13.0

<https://seedcord.org/docs/packages/core/0.13.0/classes/folder-exports>

Registers the values that the files in one folder export, and keeps them registered while you
edit those files under `seedcord dev`. `is` picks which exports count.

A value that two files export, like a class and the barrel that re-exports it, registers once and
unregisters once neither file exports it.

Call `load()` from your plugin's `init()` and `handle()` from its `onHmr()`.

```ts
class FolderExports<TUnit>
```

## Examples

```ts
this.jobs = new FolderExports({
    dir,
    is: isJob,
    register: (job) => this.registry.set(job.name, job),
    unregister: (job) => this.registry.delete(job.name),
    logger: this.logger
});
```

## Constructors

### constructor

```ts
FolderExports(options: FolderExportsOptions<TUnit>)
```

Constructs a new instance of the `FolderExports` class

## Methods

### handle

```ts
public async handle(event: HmrUpdateEvent): Promise<void>
```

Unloads or reloads the files in this folder that an HmrUpdateEvent affects. When that
unloads something, it also retries every file whose `register` threw earlier.

### load

```ts
public async load(): Promise<void>
```

Imports every file in the folder and registers each unit once.
