@jetjs/core

interface PluginLoader

Interface to implement different Strategies to load plugins. E.g. AmdPluginLoader in the future to load plugins if they are needed.

Methods

MethodReturnDescription
getStrategyName()
string
init(registry)
void
isLoaded(plugin)
boolean
load(plugin)
Promise

Method Details

  • getStrategyName() Method

    Signature:
    getStrategyName(): string;
    Returns:
    string

    name from the loading strategy. This name is used to register and retrieve the plugin loader instance.

  • init(registry) Method

    initiates the plugin loader with the plugin registry. This is needed, in order that the loader can check if a plugin is already loaded, or if the loading process was successful

    Signature:
    init(registry: PluginRegistry): void;
    Returns:
    void
    ParameterTypeDescription
    registry
    PluginRegistry

    the plugin registry

  • isLoaded(plugin) Method

    Checks if the given plugin is already loaded.

    Signature:
    isLoaded(plugin: PluginName): boolean;
    Returns:
    boolean

    true if the given plugin is already loaded. Otherwise false.

    ParameterTypeDescription
    plugin
    PluginName
  • load(plugin) Method

    Loads the given Plugin and resolves the promise after successful loading. If the loading fails, the Promise will be rejected with an Error.

    load can called as often as the callee like, the me thod implementation should implement the optimal handling, to prevent duplicate loading

    Signature:
    load(plugin: PluginName): Promise<never>;
    Returns:
    Promise

    Promise to get notified after loading is done

    ParameterTypeDescription
    plugin
    PluginName