HtmlView

HtmlView can render any html. The following example renders html with ‘hello’ word.

function main(arg)
{
   var htmlView = new HtmlView('<div><h1>hello</h1</div>'); 
   return [htmlView];
}
main(arg);

HtmlView

You can use grave accent to handle multi lines text.

function main(arg)
{
   var htmlView = new HtmlView(`
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>`); 
  
   return [htmlView];
}
main(arg);

HtmlView

HtmlView can be used to render any object in json format.

function main(arg)
{
   var person = { "name":"John", "age":30, "car":null };
   var personJson = JSON.stringify(person, null, 4);
   var htmlView = new HtmlView('<pre>' + personJson + '</pre>'); 
   return [htmlView];
}
main(arg);

HtmlView

Also custom JavaScript can be used on a page.

function main(arg)
{
   var js = `
<div id="greeting"></div>
<script>
  var greeting = document.getElementById('greeting');
  greeting.innerHTML = 'Hola!';
</script>
`;
   var htmlView = new HtmlView(js); 
   return [htmlView];
}
main(arg);

HtmlView