@boost/core
Version:
Robust pipeline for creating dev tools that separate logic into routines and tasks.
35 lines • 1.35 kB
TypeScript
import { Constructor } from '@boost/common';
import { Debugger } from '@boost/debug';
import Tool from './Tool';
export interface OptionsObject {
[key: string]: any;
}
export default class ModuleLoader<Tm> {
contract: Constructor<Tm> | null;
debug: Debugger;
scopes: string[];
tool: Tool<any>;
typeName: string;
constructor(tool: Tool<any>, typeName: string, contract?: Constructor<Tm> | null, scopes?: string[]);
/**
* Import a class definition from a Node module and instantiate the class
* with the provided options object.
*/
importModule(name: string, args?: any[]): Tm;
/**
* If loading from an object, extract the module name and use the remaining object
* as options for the class instance.
*/
importModuleFromOptions(baseOptions: OptionsObject, args?: any[]): Tm;
/**
* Load and or instantiate a module for the `typeName` configuration property.
* If a class instance, use directly. If a string, attempt to load and
* instantiate from a module. If an object, extract the name and run the previous.
*/
loadModule(module: string | OptionsObject | Tm, args?: any[]): Tm;
/**
* Load multiple modules.
*/
loadModules(modules?: (string | OptionsObject | Tm)[], args?: any[]): Tm[];
}
//# sourceMappingURL=ModuleLoader.d.ts.map