Home Manual Reference Source Test Repository
import ModuleManager from 'modulemanager/src/index.js'
public class | source

ModuleManager

Manages different modules

Example:

import ModuleManager from modulemanager;

let moduleManager = new ModuleManager({folder: 'folder'});

Test:

Constructor Summary

Public Constructor
public

constructor(options: Object)

initializes all variables

Member Summary

Public Members
public

folder seen from caller

public

logging when function is run

public

Map containing all active modules

public

JSON object containing additional options

public

folder of caller

Method Summary

Public Methods
public

activate(module: Object | string, options: Object)

activates a module

public

deactivate(module: Object | string)

deactivates a module

public

install(module: Object | string, options: Object)

installs a module and activates it afterwards

public

uninstall(module: Object | string, options: Object)

deactivates a module, then removes it

public

update(module: Object | string, options: Object)

deactivates a module, then updates it and optionaly activates it afterwards

Public Constructors

public constructor(options: Object) source

initializes all variables

Params:

NameTypeAttributeDescription
options Object
  • optional

requires a json object with options

options.folder string
  • optional
  • default: 'modules'

string with the folderPath relative to caller

options.logging boolean
  • optional
  • default: false

logs if a method is run

options.done boolean
  • optional

called when constructor completed

options.passCaller boolean
  • optional
  • default: true

pass modulemanager as parrent to modules

options.moduleList Array<string, Object>
  • optional

array of modules to activate

options.moduleList.name Object
  • optional

module name

options.moduleList.path Object
  • optional

path to the module

options.options Object
  • optional

options to pass to the modules

Throw:

ReferenceError

throw referencerror when necessary options are missing

Test:

Public Members

public folder: string source

folder seen from caller

public logging: boolean source

logging when function is run

public moduleMap: Map<string, Object> source

Map containing all active modules

public options: Object source

JSON object containing additional options

public requester: string source

folder of caller

Public Methods

public activate(module: Object | string, options: Object) source

activates a module

Params:

NameTypeAttributeDescription
module Object | string
  • nullable: false

name of the module or module object

options Object
  • optional

additional options

options.path string
  • optional

path to the module

Throw:

SyntaxError

throw syntaxerror when error in modules activatefunction

Test:

public install(module: Object | string, options: Object) source

installs a module and activates it afterwards

Params:

NameTypeAttributeDescription
module Object | string
  • nullable: false

name of the module or module object

options Object
  • optional

additional options

options.path string
  • optional

path to the module

options.activate boolean
  • optional

activate the module after updating

Throw:

SyntaxError

throw syntaxerror when error in modules installfunction

Test: