\n","publisher":{"@type":"Organization","name":"MML","url":"https://mml.io"}}MML - Metaverse Markup Language

MMLPromptEvent extendsRemoteEvent

Received when a user triggers a prompt with a value.

<m-prompt
  message="What is your favourite color?"
  placeholder="Write a color"
  prefill="orange"
  id="my-prompt"
  y="2"
>
  <m-cube id="color-cube" color="blue"></m-cube>
</m-prompt>

<m-label id="my-label" y="5" width="10" content="Hello World!" font-size="80" alignment="center" color="#BBB" font-color="#000"></m-label>

<script>
  const mPrompt = document.getElementById("my-prompt");
  const mLabel = document.getElementById("my-label");
  const mCube = document.getElementById("color-cube");

  function handlePrompt(e) {
    const color = e.detail.value;
    mLabel.setAttribute("content", color);
    mCube.setAttribute("color", color);
  }

  mPrompt.addEventListener("prompt", handlePrompt);
</script>

detailisReadonly

detail: { value: string connectionId: number }

Type declaration

  • value:  
  • string

The value of the prompt.

  • connectionId:  
  • number

The unique numeric id of the connection that sent the event.

typeisReadonly

The **

type

** read-only property of the Event interface returns a string containing the event's type.

MDN Reference

Literal: prompt