pandora
Version:
76 lines (75 loc) • 2.12 kB
TypeScript
/**
* A proxy (or called accessor) of the WorkerContext, to provide a grace interface to use
*/
import { WorkerContext } from './WorkerContext';
import { Environment } from 'pandora-env';
import { Applet, Configurator, Service } from '../domain';
import { Facade } from 'pandora-hub';
/**
* Class WorkerContextAccessor
* A easy way to access WorkerContext
*/
export declare class WorkerContextAccessor {
/**
* Original context object
*/
context: WorkerContext;
/**
* @param context - Original context object
*/
constructor(context: any);
/**
* Current application name
* @returns {string}
*/
readonly appName: string;
/**
* Current application directory path
* @returns {string}
*/
readonly appDir: string;
/**
* Current process name, such as worker, background
* @returns {string}
*/
readonly processName: string;
/**
* Current environment identical string, such as production, development
* @returns {string}
*/
readonly env: string;
/**
* Properties from configurator.getProperties(), that should injected by procfile.js or globalConfig
* @returns {any}
*/
readonly config: any;
/**
* Configurator object, that should injected by procfile.js or globalConfig
* @returns {Configurator}
*/
readonly configurator: Configurator;
/**
* Environment object, that should injected by procfile.js or globalConfig
* @returns {Environment}
*/
readonly environment: Environment;
ipcHub: Facade;
/**
* Get applet by applet's name
* @param {string} name - Name of applet
* @returns {Applet}
*/
getApplet<T extends Applet>(name: string): T;
/**
* Get service instance by service's name
* @param {string} name - Name of service
* @returns {Service}
*/
getService<T extends Service>(name: string): T;
/**
* Get a service class by service's name
* @param {string} name - Name of service
* @returns {class}
*/
getServiceClass(name: string): any;
}