17 lines
616 B
TypeScript
17 lines
616 B
TypeScript
import { getSingleton } from "../helpers/singletonMethod";
|
|
import { nopeObservable } from "../observables/nopeObservable";
|
|
import { INopeRpcDispatcherOptions } from "../types/communication.interface";
|
|
import { nopeDispatcher } from "./nopeDispatcher";
|
|
|
|
/**
|
|
* Function to extract a Singleton Dispatcher
|
|
* @param options The provided options for the Dispatcher
|
|
*/
|
|
export function getRpcDispatcher(options: INopeRpcDispatcherOptions) {
|
|
|
|
const container = getSingleton('nopeBackendDispatcher.instance', () => {
|
|
return new nopeDispatcher(options, () => new nopeObservable());
|
|
});
|
|
|
|
return container.instance
|
|
} |