nope/lib/dispatcher/getDispatcher.ts

15 lines
479 B
TypeScript
Raw Normal View History

2020-08-30 08:25:53 +00:00
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
}