Skip to content

Unit: Plugin

Jake edited this page Jul 20, 2018 · 2 revisions

Leverage Plugins

Plugins are what define different kinds of interactions that can be performed. These interactions can range anywhere from HTTP requests to Midi signals to state management.

Leverage General Architecture

Plugin Unit

Plugin Interface

A valid plugin unit conforms to this interface:

interface PluginUnit {
  is: 'plugin';
  type: string | string[];
  
  config?: {
    dependencies?: {
      plugins?: string[];
      services?: string[];
    };

    [key: string]: any;
  };

  middleware?: (middleware: Middleware) => void

  [key: string]: any;  
}

Component Installation

Every plugin has an installation method with the same name as that plugin's type. The install method is where a plugin receives all of the added components. Here is an example:

const plugin = {
  is: 'component',
  type: 'http',

  // here is the installation method
  http (component: Component) {
    // do something to install the component
  }
}
Clone this wiki locally