import { Container } from 'inversify' ; import { isNil } from 'lodash' ; import { WebControllerDispatcher } from './web-controller-dispatcher' ; let globalWebControllerDispatcher ; export async function getGlobalWebControllerDispatcher ( container ) { if ( isNil ( globalWebControllerDispatcher ) ) { globalWebControllerDispatcher = createWebDispatcher ( container ) ; } return globalWebControllerDispatcher ; } async function createWebDispatcher ( container ) { const dispatcher = new WebControllerDispatcher ( container ) ; await dispatcher . start ( ) ; return dispatcher ; }