This page will cover how to extend the library to fit your needs
Overview
This module can be extended by a plugin system. A valid plugin is a plugin the exports and instance of Plugin. It is registered by passing the exported instance to Commands.prototype.addPlugin
Example Plugin:
This is an example plugin that does the very basics
// First importing the classconstPlugin=require("djs-command-control");// Creating our plugin with a unique nameconstplugin=newPlugin("unique-name")// What must out plugin do when it initializesplugin.initialize= (djsCommandControl, ctx) => {// Let's create a new variable in the Commands Classctx.ourNewVariable ="Hello Word";// Let's add a custom variable to out global djsCommandControl object inside clientdjsCommandControl.ourCustomVariable ="Duck";// Let's add another category to the command handler// This category is now available for any command we want to add to itctx.categories.push({ name:"egg", title:"Uninstatiated Chicken"});// Now let's add a fail condition, if pond === missing// returning false will make sure the plugin is not loadedif (pond ==="missing") returnfalse;// Returning our modified djsCommandControl Objects tells// the commands class that we have finished what we want// and it can load the plugin nowelsereturn djsCommandControl;}// Let's add a bundled command, let's say it was// already required and is in a variable called customCommand of type `Command`plugin.addBundledCommand(customCommand);// Now we can either export the plugin instance to import it later,// or we can directly add it to the commands object.// For this example I add it to the command objectcommands.addPlugin(plugin)