import type * as d from '../../declarations' ; import * as c from '../dev-server-constants' ; import { appReset , initAppUpdate } from './app-update' ; import { initBuildProgress , initBuildStatus } from '../client' ; import { initClientWebSocket } from './client-web-socket' ; export const initDevClient = ( win , config ) => { try { if ( win [ 's-dev-server' ] ) { return ; } win [ 's-dev-server' ] = true ; initBuildStatus ( { window : win } ) ; initBuildProgress ( { window : win } ) ; initAppUpdate ( win , config ) ; if ( isInitialDevServerLoad ( win , config ) ) { win [ 's-initial-load' ] = true ; appReset ( win , config , ( ) => { initClientWebSocket ( win , config ) ; } ) ; } else { initClientWebSocket ( win , config ) ; } } catch ( e ) { console . error ( e ) ; } } ; const isInitialDevServerLoad = ( win , config ) => { let pathname = win . location . pathname ; pathname = '/' + pathname . substring ( config . basePath . length ) ; return pathname === c . DEV_SERVER_INIT_URL ; } ;