Skip to main content

Plugin <T, Options>

Hierarchy

  • Contract<Options>
    • Plugin

Implements

Index

Constructors

constructor

  • new Plugin<T, Options>(options?: Options): Plugin<T, Options>
  • Type parameters

    • T = unknown
    • Options: object = {}

Properties

abstractname

name: string

Unique name of the plugin. Typically the npm package name.

readonlyoptions

options: Readonly<Required<Options>>

Validated and configured options.

Methods

abstractblueprint

  • blueprint(schemas: __module, onConstruction?: boolean): object
  • Define an optimal blueprint in which to validate and build the options object passed to the constructor, or when manual setting.

    A boolean is passed as the 2nd argument to determine whether this is validating on class instantiation (first time), or by calling configure() (all other times).

configure

  • configure(options?: Partial<Options> | (options: Required<Options>) => Partial<Options>): Readonly<Required<Options>>
  • Set an options object by merging the new partial and existing options with the defined blueprint, while running all validation checks. Freeze and return the options object.

    object.configure({ name: 'Boost' });

    object.configure((prevOptions) => ({
    nestedObject: {
    ...prevOptions.nestedObject,
    some: 'value',
    },
    }));

shutdown

  • shutdown(tool: T): void

startup

  • startup(tool: T): void