Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KawkahMiddleware

Hierarchy

  • KawkahMiddleware

Index

Constructors

constructor

Properties

Private _groups

_groups: IKawkahMap<string[]>

Private _middleware

Private core

Methods

add

disable

  • disable(...names: string[]): this
  • Disables middleware by name in the collection.

    Parameters

    • Rest ...names: string[]

      the names of middleware to be disabled.

    Returns this

disabled

  • disabled(): string[]
  • disabled(name: string): boolean
  • Returns all disabled middleware.

    Returns string[]

  • Returns name if middlware is disabled.

    Parameters

    • name: string

      the name of the middleware to inspect.

    Returns boolean

enable

  • enable(...names: string[]): this
  • Enables middleware by name in the collection.

    Parameters

    • Rest ...names: string[]

      the names of middleware to be disabled.

    Returns this

enabled

  • enabled(): string[]
  • enabled(name: string): boolean
  • Returns all enabled middleware by name.

    Returns string[]

  • Returns true if middleware is enabled.

    Parameters

    • name: string

      the name of the middleware to inspect.

    Returns boolean

group

remove

  • remove(...names: string[]): this
  • Remove middleware from collection.

    Parameters

    • Rest ...names: string[]

      the names of middlware to be removed.

    Returns this

removeGroup

  • removeGroup(group: string): this
  • Remove a group.

    Parameters

    • group: string

      the group to be removed.

    Returns this

resetGroup

  • Removes existing group then creates with new order of middleware names.

    Parameters

    • group: string | KawkahMiddlewareGroup

      the name of the group to reset.

    • Rest ...names: string[]

      the middleware names to assign to the group.

    Returns KawkahMiddleware

run

  • Runs collection of middleware breaking on errors.

    Parameters

    • collection: IKawkahMiddleware[]

      the collection of middleware to run.

    • Rest ...args: any[]

      the arguments to pass to middleware handlers.

    Returns any

runGroup

  • Runs middleware for the specified group.

    Parameters

    • name: KawkahMiddlewareGroup

      the name of the group.

    • Rest ...args: any[]

      the arguments to pass to middleware.

    Returns object

    • command: function
      • command(name: string): methods
    • force: function
      • force(enabled: boolean): methods
    • run: function
      • run<T>(...args: any[]): T
      • Type parameters

        • T

        Parameters

        • Rest ...args: any[]

        Returns T

runNames

  • runNames(name: string | string[], ...args: any[]): object
  • Runs middleware for the specified name(s).

    Parameters

    • name: string | string[]

      the name or names to be run.

    • Rest ...args: any[]

      the arguments to pass to middleware.

    Returns object

    • command: function
      • command(name: string): methods
    • force: function
      • force(enabled: boolean): methods
    • run: function
      • run<T>(...args: any[]): T
      • Type parameters

        • T

        Parameters

        • Rest ...args: any[]

        Returns T

Generated using TypeDoc