From 486586022ecd38d391879472cce78284675a9295 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 6 Apr 2022 11:45:14 +0100 Subject: [PATCH] docs --- apps/sched/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/sched/README.md b/apps/sched/README.md index 03d93c688..54c61679c 100644 --- a/apps/sched/README.md +++ b/apps/sched/README.md @@ -19,6 +19,7 @@ Alarms are stored in an array in `sched.json`, and take the form: ``` { id : "mytimer", // optional ID for this alarm/timer, so apps can easily find *their* timers + appid : "myappid", // optional app ID for alarms that you set/use for your app on : true, // is the alarm enabled? t : 23400000, // Time of day since midnight in ms (if a timer, this is set automatically when timer starts) dow : 0b1111111, // Binary encoding for days of the week to run alarm on @@ -32,7 +33,7 @@ Alarms are stored in an array in `sched.json`, and take the form: date : "2022-04-04", // OPTIONAL date for the alarm, in YYYY-MM-DD format // eg (new Date()).toISOString().substr(0,10) - msg : "Eat food", // message to display + msg : "Eat food", // message to display. last : 0, // last day of the month we alarmed on - so we don't alarm twice in one day! rp : true, // repeat the alarm every day? vibrate : "...", // OPTIONAL pattern of '.', '-' and ' ' to use for when buzzing out this alarm (defaults to '..' if not set) @@ -41,7 +42,7 @@ Alarms are stored in an array in `sched.json`, and take the form: timer : 5*60*1000, // OPTIONAL - if set, this is a timer and it's the time in ms js : "load('myapp.js')" // OPTIONAL - a JS command to execute when the alarm activates (*instead* of loading 'sched.js') // when this code is run, you're responsible for setting alarm.on=false (or removing the alarm) - data : { ... } // OPTIONAL - your app can store custom data in here if needed + data : { ... } // OPTIONAL - your app can store custom data in here if needed (don't store a lot of data here) } ``` @@ -73,10 +74,16 @@ require("sched").reload(); // loading the settings app. The alarm will not be removed/stopped // automatically. require("sched").setAlarm("customrunner", { + appid : "myapp", js : "load('setting.app.js')", timer : 1*60*1000, // 1 Minute }); + +// If you have been specifying `appid` you can also find any alarms that +// your app has created with the following: +require("sched").getAlarms().filter(a=>a.appid=="myapp"); ``` If your app requires alarms, you can specify that the alarms app needs to -be installed by adding `"dependencies": {"scheduler":"type"},` to your metadata. +be installed by adding `"dependencies": {"scheduler":"type"},` to your app's +metadata.