nope-js-node
Version:
NoPE Runtime for Nodejs. For Browser-Support please use nope-browser
41 lines (40 loc) • 1.51 kB
TypeScript
/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
*/
import { IDispatcherConstructor, INopeDispatcher, INopeDispatcherOptions } from "../types/nope/nopeDispatcher.interface";
export type TAdditionalOptions = {
/**
* A different Constructor class.
*/
dispatcherConstructorClass?: IDispatcherConstructor;
/**
* Enalbe the Dispatcher to exists as singleton in the runtime. Defaults to `true`.
*/
singleton?: boolean;
/**
* Flag to enable using the Base-Services. Defaults to `true`
*/
useBaseServices?: boolean;
/**
* Flag to load services exported with `exportAsNopeService`. Defaults to `true`
*/
useLinkedServices?: boolean;
};
/**
* Helper to get a Dispatcher.
*
*
* ```typescript
* // Create a communication layer:
* const communicator = getLayer("event");
* // Now create the Dispatcher.
* const dispatcher = getDispatcher({communicator});
* ```
*
* @export
* @param {INopeDispatcherOptions} dispatcherOptions The options, that will be used for the dispatcher.
* @param {TAdditionalOptions} [options={}] Options. You can provide a different Dispatcher-Class; Controll the scope (Singleton or not.) and define wehter the Base-Services should be added etc. see {@link TAdditionalOptions}
* @returns {INopeDispatcher} The dispatcher.
*/
export declare function getDispatcher(dispatcherOptions: INopeDispatcherOptions, options?: TAdditionalOptions): INopeDispatcher;