Skip to content

Class: BoundData ​

BoundData is a simple utility class for the management of plugin data, with plugin scoping automatically supplied. An instance is available on instances of BdApi.

Methods ​

delete() ​

delete(key): void

Deletes a piece of stored data. This is different than saving null or undefined.

Parameters ​

ParameterTypeDescription
keystringWhich piece of data to delete.

Returns ​

void


load() ​

load<T>(key): T

Loads previously stored data.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterTypeDescription
keystringWhich piece of data to load

Returns ​

T

The stored data


recache() ​

recache(): Promise<boolean>

Recaches JSON-serializable save file.

Returns ​

Promise<boolean>

Whether the data successfully recached

⚠️ Use of recaching is discouraged!

Recache loads can block the filesystem and significantly degrade performance. Use this method only for debugging or testing purposes. Avoid frequent recaching in production environments.


save() ​

save(key, data): void

Saves JSON-serializable data.

Parameters ​

ParameterTypeDescription
keystringWhich piece of data to store
dataanyThe data to be saved

Returns ​

void