Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AppPlugin<T>

The base class for app plugins

Type parameters

  • T

Hierarchy

Implements

Index

Accessors

state

  • The plugin state contains fields which are universal across all plugins of each type (eg: status)

    Each plugin instance has its own state

    Returns IAppState

store

  • get store(): T
  • The plugin store can be used to persist any custom data

    Use the generic parameter to specify a store interface

    Each plugin instance has its own store

    Returns T

Methods

createEngineSubscription

  • createEngineSubscription(name: string): Promise<Subscription<any>>
  • Create a subscription to a given topic on the engine plugin

    Parameters

    • name: string

      The pubsub topic name to subscribe to

    Returns Promise<Subscription<any>>

createSubscription

  • Create a subscription to a given topic on another plugin

    Parameters

    • target: ObjectId

      The target identifier for the plugin for the topic

    • name: string

      The pubsub topic name to subscribe to

    Returns Promise<Subscription<any>>

createTopic

  • createTopic(name: string): Topic<any>
  • Create a pubsub topic with a name (use dot seperation for nesting)

    Parameters

    • name: string

    Returns Topic<any>

destroy

  • destroy(): Promise<void>
  • Called when a plugin should destroy itself, this should be used with super.destroy()

    Returns Promise<void>

engineMethod

  • engineMethod(method: string): (Anonymous function)
  • Execute an instance method on the engine plugin through a proxy

    Parameters

    • method: string

      The method name to execute

    Returns (Anonymous function)

    A function which can be executed with the arguments to pass to target method

engineStaticMethod

  • engineStaticMethod(method: string): (Anonymous function)
  • Execute a static instance method on the engine plugin through a proxy

    Parameters

    • method: string

      The method name to execute

    Returns (Anonymous function)

    A function which can be executed with the arguments to pass to target method

init

  • init(): Promise<void>
  • Called when a plugin should initialize itself, this should be used with super.init()

    All plugins have been constructed at this point

    Returns Promise<void>

method

  • method(target: ObjectId, method: string): (Anonymous function)
  • Execute an instance method on another plugin through a proxy

    Parameters

    • target: ObjectId

      The plugin instance to use

    • method: string

      The method name to execute

    Returns (Anonymous function)

    A function which can be executed with the arguments to pass to target method

setState

  • Update the plugin state and trigger stateDidUpdate notifications

    Parameters

    • state: Partial<IAppState>

      Object to merge into existing state (only root keys are merged)

    Returns Promise<void>

setStore

  • setStore(store: Partial<T>): Promise<void>
  • Update the plugin store and trigger storeDidUpdate notifications

    Parameters

    Returns Promise<void>

stateDidUpdate

staticMethod

  • staticMethod(plugin: ObjectId, method: string): (Anonymous function)
  • Execute a static method on another plugin through a proxy

    Parameters

    • plugin: ObjectId
    • method: string

      The method name to execute

    Returns (Anonymous function)

    A function which can be executed with the arguments to pass to target method

storeDidUpdate

  • storeDidUpdate(prevStore: T): void
  • Notify the plugin that a store change has taken place

    Parameters

    • prevStore: T

      The previous store object which has been replaced

    Returns void

Static createEngineConfig

  • Generate an engine specific config when creating an app model in an environment

    Parameters

    • environment: IEnvironmentModel

      The environment in use, should be used for context

    • model: IAppModel

      The app model which is being created

    Returns object

    The config to pass to the engine

Static createPrototype

  • Create a new model for a given prototype

    Parameters

    • prototype: IPrototypeModel

      The full prototype model, should be used for context

    • name: string

      Name of the model that should be created

    Returns object

    The model to be created

Static staticMethod

  • staticMethod(plugin: ObjectId, method: string): (Anonymous function)
  • Execute a static instance method on another plugin through a proxy

    Parameters

    • plugin: ObjectId
    • method: string

      The method name to execute

    Returns (Anonymous function)

    A function which can be executed with the arguments to pass to target method