2020-11-06 08:10:30 +00:00
|
|
|
/**
|
|
|
|
* @author Martin Karkowski
|
|
|
|
* @email m.karkowski@zema.de
|
|
|
|
* @create date 2020-11-06 08:52:48
|
2020-11-06 13:18:10 +00:00
|
|
|
* @modify date 2020-11-06 11:25:51
|
2020-11-06 08:10:30 +00:00
|
|
|
* @desc [description]
|
|
|
|
*/
|
|
|
|
|
2020-08-30 08:25:53 +00:00
|
|
|
import { getSingleton } from "../helpers/singletonMethod";
|
2020-10-15 09:38:59 +00:00
|
|
|
import { NopeObservable } from "../observables/nopeObservable";
|
2020-11-06 08:10:30 +00:00
|
|
|
import { INopeRpcDispatcherOptions } from "../types/nope/communication.interface";
|
2020-09-28 16:38:35 +00:00
|
|
|
import { nopeDispatcher } from "./nopeDispatcher";
|
2020-08-30 08:25:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to extract a Singleton Dispatcher
|
2020-09-12 00:59:30 +00:00
|
|
|
* @param options The provided options for the Dispatcher
|
2020-08-30 08:25:53 +00:00
|
|
|
*/
|
2020-11-06 13:18:10 +00:00
|
|
|
export function getDispatcher(options: INopeRpcDispatcherOptions) {
|
2020-08-30 08:25:53 +00:00
|
|
|
|
2020-09-12 00:59:30 +00:00
|
|
|
const container = getSingleton('nopeBackendDispatcher.instance', () => {
|
2020-10-15 09:38:59 +00:00
|
|
|
return new nopeDispatcher(options, () => new NopeObservable());
|
2020-09-12 00:59:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return container.instance
|
|
|
|
}
|