client.js
/**
   * Handles an incoming message.
   * @param {any} msg Can be any type, but we only process messages
   * types that we understand, other messages are ignored
   */
Handles an incoming message.
@param {any} msg Can be any type, but we only process messages
types that we understand, other messages are ignored
Handles an incoming message . @param { any } msg Can be any type but we only process messages types that we understand other messages are ignored
function handleMessage(msg) {
    if (!isValidMessage(msg)) return
    switch (msg[0]) {
      case msgType.RESPONSE:
        return handleResponse( (msg))
      case msgType.EMIT:
        return handleEmit( (msg))
      default:
        console.warn(
          `Received unexpected message type: ${msg[0]}. (Message was ignored)`
        )
    }
  }
function handleMessage ( msg ) { if ( ! isValidMessage ( msg ) ) return switch ( msg [ 0 ] ) { case msgType . RESPONSE : return handleResponse ( ( msg ) ) case msgType . EMIT : return handleEmit ( ( msg ) ) default : console . warn ( ` ${ msg [ 0 ] } ` ) } }
Handles an incoming message.
Handles an incoming message .
/** @type {MsgResponse} */ /** @type {MsgEmit} */