Abstract
Static
baseThe base directory of the plugin.
Static
metaThe metadata for the plugin, as passed into HindenburgPlugin.
Static
packageThe package.json of this plugin.
The directory of the plugin.
The config passed into this plugin, usually by the config.json
on the
server.
A console logger for the plugin.
The metadata for the plugin, as passed into HindenburgPlugin.
The package.json associated with this plugin.
Get a plugin
Asynchronous method that is called when the plugin is first loaded into the worker or a room, useful for connecting to any servers or loading large amounts of data before the plugin can actually be used, as the server will wait for it to finish.
.@HindenburgPlugin("hbplugin-my-plugin")
export class MyPlugin extends WorkerPlugin {
async onPluginLoad() {
const res = await fetch("https://icanhazip.com/");
const ip = await res.text();
console.log("My ip is " + ip);
}
}
Method that is called when the plugin is unloaded from the worker or room, useful for destroying any connections to any servers, clearing up extra event listeners to prevent memory leaks, or closing any server sockets.
Not called when the server shuts down, and the server also does not wait for it to finish.
.@HindenburgPlugin("hbplugin-my-plugin")
export class MyPlugin extends WorkerPlugin {
async onPluginUnload() {
this.logger.info("Closing socket..");
await this.socket.close();
this.logger.info("Closed socket");
}
}
Generated using TypeDoc
Represents a base plugin for Hindenburg. Should not be extended directly, see WorkerPlugin and RoomPlugin to choose the scope of the plugin.
Needs to be decorated with HindenburgPlugin to actually be able to be imported and loaded.