Thanks again Lyndel, I want to run a function 'time' recurring in the background. That must be stable and independent. I've created a library to run an intervalTimer every 60 seconds. I've putted the library at system level.
/*! @title test5.v-Fischer @version 1.0 @author v Fischer */
var updateInterval = 60 * 1000; // 1 min; in msec
function getDate() { d = new Date(); return d.getFullYear() + "-" + ("0" + Number(d.getMonth()+1)).slice(-2)+"-"+ d.getDate() + "T" + GUI.getDisplayTime() + ":" + ("0" + d.getSeconds()).slice(-2); }
function time() { var timePattern = new RegExp('(\\d+):(\\d+)((am|pm)*)','g'); GUI.getDisplayTime().match(timePattern);
var hour = parseInt(RegExp.$1,10); var minute = parseInt(RegExp.$2,10);
if (hour === 3 && minute === 55) {CF.widget("A4","B","C").executeActions();}
var ampm = RegExp.$3; var seconds = new Date().getSeconds(); } time();
/* schedule periodic updates for when the TSU sits in the charging dock and it is powered on. */ function periodicUpdate_2(activity) { System.setDebugMask(9); System.print(getDate() + " [ScheduleAfter]_____TIMER"); time(); activity.scheduleAfter(updateInterval, periodicUpdate_2, activity); }
Embedded is a function 'time' that parses the hours and minutes out and a condition if (hour === 3 && minute === 55) .
After invoking from a button with the button script periodicUpdate_2(CF.activity()); the stuff is running OK every 60 seconds.
When the time is reached (3:55) {CF.widget ("A4","B","C").scheduleActions();} is running OK
After that or after jumping to another activity/page the intervalTimer stops although the library is at system level.
I ever thought it would be running over the whole system on all pages and activities because the library is system level but it isn't so.