Async Function With Template

hello. I am trying to create a popup window that displays text from a file, but it just keeps displaying “[object Promise]” only. The console log output is correct, its just not going through to the actual template for some reason.

Here is the relevant code

template: async function()
{
var output = await fetch(‘ChatLogs.txt’).then((output) => output.text());
console.log("output :: " + output);

        return await output;
      }

While I’m pretty sure its bugged in the way I did above, I created a workaround by creating a separate function to load the text file, putting that data in a string before I reach template, then setting template to be that string (no function used there).

Hi @username2

Unfortunately, template of any widget cannot be set as async function, but it can render anything from data that was loaded to a component.
In this context, the component Template works similar to List or Datatable, but expects a single data record instead of a data array.
Here are examples of how to handle loaded text/object: Code Snippet