Home Manual Reference Source
public class | source

Plugins

This service is in charge of looking for, loading and registering plugins for the app.

Constructor Summary

Public Constructor
public

constructor(prefix: string, app: Projext, appLogger: Logger, packageInfo: Object, pathUtils: PathUtils)

Class constructor.

Member Summary

Public Members
public

The local reference to the main app.

public

A local reference for the appLogger service.

public

The implementation package.json

public

A local reference for the pathUtils service.

public

The prefix the dependencies need to have in order to be identified as plugins.

Method Summary

Public Methods
public

Gets the names of the loaded plugins.

public

load(dependencies: boolean, devDependencies: boolean)

Search for plugins on the package.json and loads them.

public

loadFromFile(filePath: string)

Loads a plugin from a file relative to the project root directory.

public

Checks whether a plugin was loaded or not.

Public Constructors

public constructor(prefix: string, app: Projext, appLogger: Logger, packageInfo: Object, pathUtils: PathUtils) source

Class constructor.

Params:

NameTypeAttributeDescription
prefix string

The prefix the dependencies need to have in order to be identified as plugins.

app Projext

To send to the plugis so they can register their services.

appLogger Logger

To indicate if a plugin couldn't be loaded.

packageInfo Object

To read the dependencies list.

pathUtils PathUtils

To build the dependencies paths.

Public Members

public app: Projext source

The local reference to the main app.

public appLogger: Logger source

A local reference for the appLogger service.

public packageInfo: Object source

The implementation package.json

public pathUtils: PathUtils source

A local reference for the pathUtils service.

public prefix: string source

The prefix the dependencies need to have in order to be identified as plugins.

Public Methods

public getLoadedPlugins(): string source

Gets the names of the loaded plugins.

Return:

string

public load(dependencies: boolean, devDependencies: boolean) source

Search for plugins on the package.json and loads them.

Params:

NameTypeAttributeDescription
dependencies boolean
  • optional
  • default: true

Whether or not to look for plugins on the dependencies.

devDependencies boolean
  • optional
  • default: true

Whether or not to look for plugins on the devDependencies.

public loadFromFile(filePath: string) source

Loads a plugin from a file relative to the project root directory.

Params:

NameTypeAttributeDescription
filePath string

The path to the file.

public loaded(name: string): boolean source

Checks whether a plugin was loaded or not.

Params:

NameTypeAttributeDescription
name string

The plugin's name.

Return:

boolean