connectToLocalhost () {
    let connection = (error) => {
      if (error) {
        console.log(error)
        modalDialogCustom.alert(
          'Cannot connect to the remixd daemon.' +
          'Please make sure you have the remixd running in the background.'
        )
        this.canceled()
      } else {
        this.fileSystemExplorer.ensureRoot()
      }
    }
    if (this.locahostProvider.isConnected()) {
      this.locahostProvider.close((error) => {
        if (error) console.log(error)
      })
    } else if (!isElectron()) {
      // warn the user only if he/she is in the browser context
      modalDialog(
        'Connect to localhost',
        remixdDialog(),
        { label: 'Connect',
          fn: () => {
            this.locahostProvider.init((error) => connection(error))
          }
        },
        { label: 'Cancel',
          fn: () => {
            this.canceled()
          }
        }
      )
    } else {
      this.locahostProvider.init((error) => connection(error))
    }
  }
/**
    * connect to localhost if no connection and render the explorer
    * disconnect from localhost if connected and remove the explorer
    *
    * @param {String} txHash    - hash of the transaction
    */
connect to localhost if no connection and render the explorer
disconnect from localhost if connected and remove the explorer

@param {String} txHash    - hash of the transaction
connect to localhost if no connection and render the explorer disconnect from localhost if connected and remove the explorer @param { String } txHash - hash of the transaction
connectToLocalhost () {
    let connection = (error) => {
      if (error) {
        console.log(error)
        modalDialogCustom.alert(
          'Cannot connect to the remixd daemon.' +
          'Please make sure you have the remixd running in the background.'
        )
        this.canceled()
      } else {
        this.fileSystemExplorer.ensureRoot()
      }
    }
    if (this.locahostProvider.isConnected()) {
      this.locahostProvider.close((error) => {
        if (error) console.log(error)
      })
    } else if (!isElectron()) {
      modalDialog(
        'Connect to localhost',
        remixdDialog(),
        { label: 'Connect',
          fn: () => {
            this.locahostProvider.init((error) => connection(error))
          }
        },
        { label: 'Cancel',
          fn: () => {
            this.canceled()
          }
        }
      )
    } else {
      this.locahostProvider.init((error) => connection(error))
    }
  }
connectToLocalhost ( ) { let connection = ( error ) => { if ( error ) { console . log ( error ) modalDialogCustom . alert ( 'Cannot connect to the remixd daemon.' + 'Please make sure you have the remixd running in the background.' ) this . canceled ( ) } else { this . fileSystemExplorer . ensureRoot ( ) } } if ( this . locahostProvider . isConnected ( ) ) { this . locahostProvider . close ( ( error ) => { if ( error ) console . log ( error ) } ) } else if ( ! isElectron ( ) ) { modalDialog ( 'Connect to localhost' , remixdDialog ( ) , { label : 'Connect' , fn : ( ) => { this . locahostProvider . init ( ( error ) => connection ( error ) ) } } , { label : 'Cancel' , fn : ( ) => { this . canceled ( ) } } ) } else { this . locahostProvider . init ( ( error ) => connection ( error ) ) } }
connect to localhost if no connection and render the explorer
 disconnect from localhost if connected and remove the explorer
connect to localhost if no connection and render the explorer disconnect from localhost if connected and remove the explorer
// warn the user only if he/she is in the browser context