async CallFromFrameMessage(message, Respond) {
    if(message.type !== "ElvFrameRequest") { return; }

    let callback;
    if(message.callbackId) {
      callback = (result) => {
        Respond(this.utils.MakeClonable({
          type: "ElvFrameResponse",
          requestId: message.callbackId,
          response: result
        }));
      };

      message.args.callback = callback;
    }

    try {
      const method = message.calledMethod;

      let methodResults;
      if(message.module === "userProfileClient") {
        if(!this.userProfileClient.FrameAllowedMethods().includes(method)) {
          throw Error("Invalid user profile method: " + method);
        }

        methodResults = await this.userProfileClient[method](message.args);
      } else {
        if(!this.FrameAllowedMethods().includes(method)) {
          throw Error("Invalid method: " + method);
        }

        methodResults = await this[method](message.args);
      }

      Respond(this.utils.MakeClonable({
        type: "ElvFrameResponse",
        requestId: message.requestId,
        response: methodResults
      }));
    } catch(error) {
      // eslint-disable-next-line no-console
      console.error(error);

      const responseError = error instanceof Error ? error.message : error;
      Respond(this.utils.MakeClonable({
        type: "ElvFrameResponse",
        requestId: message.requestId,
        error: responseError
      }));
    }
  }
// Call a method specified in a message from a frame
Call a method specified in a message from a frame
Call a method specified in a message from a frame
async CallFromFrameMessage(message, Respond) {
    if(message.type !== "ElvFrameRequest") { return; }
    let callback;
    if(message.callbackId) {
      callback = (result) => {
        Respond(this.utils.MakeClonable({
          type: "ElvFrameResponse",
          requestId: message.callbackId,
          response: result
        }));
      };
      message.args.callback = callback;
    }
    try {
      const method = message.calledMethod;
      let methodResults;
      if(message.module === "userProfileClient") {
        if(!this.userProfileClient.FrameAllowedMethods().includes(method)) {
          throw Error("Invalid user profile method: " + method);
        }
        methodResults = await this.userProfileClient[method](message.args);
      } else {
        if(!this.FrameAllowedMethods().includes(method)) {
          throw Error("Invalid method: " + method);
        }
        methodResults = await this[method](message.args);
      }
      Respond(this.utils.MakeClonable({
        type: "ElvFrameResponse",
        requestId: message.requestId,
        response: methodResults
      }));
    } catch(error) {
      console.error(error);
      const responseError = error instanceof Error ? error.message : error;
      Respond(this.utils.MakeClonable({
        type: "ElvFrameResponse",
        requestId: message.requestId,
        error: responseError
      }));
    }
  }
async CallFromFrameMessage ( message , Respond ) { if ( message . type !== "ElvFrameRequest" ) { return ; } let callback ; if ( message . callbackId ) { callback = ( result ) => { Respond ( this . utils . MakeClonable ( { type : "ElvFrameResponse" , requestId : message . callbackId , response : result } ) ) ; } ; message . args . callback = callback ; } try { const method = message . calledMethod ; let methodResults ; if ( message . module === "userProfileClient" ) { if ( ! this . userProfileClient . FrameAllowedMethods ( ) . includes ( method ) ) { throw Error ( "Invalid user profile method: " + method ) ; } methodResults = await this . userProfileClient [ method ] ( message . args ) ; } else { if ( ! this . FrameAllowedMethods ( ) . includes ( method ) ) { throw Error ( "Invalid method: " + method ) ; } methodResults = await this [ method ] ( message . args ) ; } Respond ( this . utils . MakeClonable ( { type : "ElvFrameResponse" , requestId : message . requestId , response : methodResults } ) ) ; } catch ( error ) { console . error ( error ) ; const responseError = error instanceof Error ? error . message : error ; Respond ( this . utils . MakeClonable ( { type : "ElvFrameResponse" , requestId : message . requestId , error : responseError } ) ) ; } }
Call a method specified in a message from a frame
Call a method specified in a message from a frame
// eslint-disable-next-line no-console