Script that always works in the background

good morning everyone,
I have a view that is a popup, my goal is to make it appear with data, the data arrives via restapi, what I would like to do is a script that polls every x seconds and executes a Get method, towards a rest api server, this server will return data (bool, string), one to make the popup visible (the boolean tag), and the other the message. but I can't find where and/or how it is possible to do it.

  • Create an expression binding on your component or on a custom property on your view.
    now(5000) // executes every 5,000 ms.
  • Add a transform, select Script.
  • Write your code in there.

This isn't a "Script that always works in the background". It's an expression that runs on an event - a time-based event in this case. When the script has finished executing it exits and releases system resources. Don't ever use a while and sleep() functions for this.

1 Like

Thank you.