When HTML is used instead of opening a web page, tags can be added to automatically run commands or actions.

Running a predefined action

Actions can be run by referencing them by name. It is also possible to pass parameters to the action.

// Parameters for an action must be encoded as an HTML attribute
var exampleactionparameters =  EncodeHtmlAttribute(text({ "message": "Hello world"}))

// Build the HTML fragment to be embedded
var html = {
    content: `<h1>SOME MESSAGE</h1>
    <!-- The following link will run an existing action by name -->
    <a class="btn" 
        data-run-action="Name of Action"  
        data-run-parameters="${exampleactionparameters}">
        Run Some Action
    </a>`,
    display: "embed"
  };

  return html;

Running commands

// The list of commands to run must be encoded as an HTML attribute.
var examplecommand = EncodeHtmlAttribute(text({
    command: "show-message",
    message: "Hello Again",
    html: false,   
    style: "BubbleInfo"  }))

// Build the HTML fragment to be embedded
var html = {
    content: `<h1>SOME MESSAGE</h1>
    <!-- The following link, will run 1 or more application commands -->
    <a class="btn" 
        data-run-commands="${examplecommand}">
        Run Some Commands
    </a>`,
    display: "embed"
  };

  return html;