Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IPluginContainer

The PluginContainer pattern is very similar to events listeners pattern but designed to let listeners hook more appropriately into some processing. One or more Plugin objects are installed into a PluginContainer and the owner of the container runs container.executeAll() Registered plugins will be then executed by priority order and if any input is passed it will transformed

Hierarchy

  • EventEmitter
    • IPluginContainer

Implemented by

Index

Events

pluginBeforeExecute

pluginException

  • Triggered by executeAll when there is an exception in one of the plugins executions. Register to this event by using container.on('plugin-exception', ...)

    asmemberof

    IPluginContainer

    Parameters

    Returns void

pluginSuccess

  • Triggered by executeAll right after a plugin's execute call finish. Register to this event by using container.on('plugin-success', ...)

    asmemberof

    IPluginContainer

    Parameters

    Returns void

Properties

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

executeAll

  • executeAll(input?: any): any | void
  • Executes all the plugins (see IPlugin.execute, in order of priority passing the data returned by previous plugin as input of the next plugin, if any. If a plugin throws an exception pluginException will be emitted.

    Parameters

    • Optional input: any

    Returns any | void

    the output, if any

getMaxListeners

  • getMaxListeners(): number
  • Returns number

install

  • add given plugin instance in this container

    Parameters

    Returns void

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

on

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

uninstall

  • uninstall(plugin: IPlugin | string): void
  • Remove an given plugin instance or plugin with given name from this container

    Parameters

    Returns void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc