nope/lib/dispatcher/getDispatcher.ts

15 lines
479 B
TypeScript

import { ICommunicationInterface, nopeDispatcher } from "./nopeDispatcher";
import { getSingleton } from "../helpers/singletonMethod";
/**
* Function to extract a Singleton Dispatcher
* @param communicator The provided communicator
*/
export function getDispatcher(communicator: ICommunicationInterface) {
const container = getSingleton('nopeBackendDispatcher.instance', () => {
return new nopeDispatcher(communicator);
});
return container.instance
}