I have think at two methods in Bangle object, Bangle.createCron and Bangle.removeCron or Bangle.cron.create/remove.
Create method have two parameters, first is a time string ("* * ...") and second is name of file ("myapp.[CRON_NAME].cron.js").
This data is writing in file or in config to not lose their after reboot.
Remove method have same parameters, and we remove data in file/config.
And regularly (e.g. at all minutes) the cron engine, read cron file (or config file). And check if this now match with time string.
If it is true we load file script.
The cron engine can be writing in C or in JS.
Surely you know which languages it is best for ?
We need to define what we want to allow as a time value?
Support just minimal (hours and minutes) or full cron support or another ?
If cron engine is good, we can use engine for alarm and calendar event.
© Espruino, powered by microcosm.
Report a problem