Hi Miha,
Have a look at the https://appstore.home.mendix.com/link/app/27/ widget. Version 4.0.0 and above support nanoflows
you can set the widget to fire every x milliseconds.
Drawbag is that you need the user to be on the same page as the widget. Maybe it is possible to add to a global container in a layout, did not try that
SOLVED by using App events widget in Native. basically does the same as this addon widget. Timer can also be set there.
Not sure if this will work, but you can probably make it yourself :D
You can make your own javascript action, with Nanoflow parameter
https://docs.mendix.com/refguide/javascript-actions#2-2-2-type
Use JS for timer https://www.w3schools.com/js/js_timing.asp and call the NF
And let us know if that will work for you :D
Here the code suggestion, enjoy! Just create a javascript action with the parameters and past the code
The execution nanoflow, show return a boolean, when true, it continues, when false it will stop.
// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
// BEGIN EXTRA CODE
let handle;
// END EXTRA CODE
/**
* @param {Nanoflow} executer
* @param {Big} interval
* @returns {Promise.<void>}
*/
export async function BackGroundTimer(executer, interval) {
// BEGIN USER CODE
handle = window.setInterval(async ()=>{
console.log("do");
const result = await executer();
console.log("result", result);
if (!result) {
console.log("clear");
window.clearInterval(handle)
}
}, interval);
// END USER CODE
}