void
chrome.storage.sync
.
This function performs the following steps:
chrome.storage.sync
.
calculatedWhen
property for any “once” schedules based on their specified time.
If a “once” schedule’s time is in the past, calculatedWhen
is removed.
For non-”once” schedules, calculatedWhen
is always removed.
calculatedWhen
if it’s valid and in the future,
and if the schedule hasn’t already run (checked against lastRun
).
schedule.time
with a 24-hour period.
dayOfWeek
at schedule.time
with a 7-day period.
Unique alarm names are generated for each day of a weekly schedule (e.g., schedule.id + "-" + dow
).
calculatedWhen
was added, modified, or removed for any schedule, the updated schedules are saved back to chrome.storage.sync
.
Errors during saving are logged to the console.
number
| null
number
| null
Promise.<(string|null)>
Promise.<(Schedule|null)>
lastRun
or calculatedWhen
properties.
The imported schedule is added to the existing list of schedules in chrome.storage.sync
.
After successfully saving, it re-registers all alarms.
Promise.<string>
Promise.<(Array.<Schedule>|null)>
chrome.storage.sync
.
Assigns new unique IDs to all imported schedules and removes any existing lastRun
or calculatedWhen
properties.
Basic validation is performed on each schedule; invalid schedules are skipped with a warning.
After successfully saving, it re-registers all alarms.
void
void
object
void
chrome.storage.sync
.
This function performs the following steps:
chrome.storage.sync
.calculatedWhen
property for any “once” schedules based on their specified time.
If a “once” schedule’s time is in the past, calculatedWhen
is removed.
For non-”once” schedules, calculatedWhen
is always removed.calculatedWhen
if it’s valid and in the future,
and if the schedule hasn’t already run (checked against lastRun
).schedule.time
with a 24-hour period.dayOfWeek
at schedule.time
with a 7-day period.
Unique alarm names are generated for each day of a weekly schedule (e.g., schedule.id + "-" + dow
).calculatedWhen
was added, modified, or removed for any schedule, the updated schedules are saved back to chrome.storage.sync
.
Errors during saving are logged to the console.
Kind: global functionvoid
- This function does not return a value directly but operates via side effects on Chrome alarms and storage.
number
| null
number
| null
- The timestamp in milliseconds for the next occurrence, or null if the time string is invalid.
Param | Type | Description |
---|---|---|
timeStr | string | The time string (e.g., “14:30” or “2023-10-26T14:30”). |
number
| null
number
| null
- The timestamp in milliseconds for the next weekly occurrence, or null if inputs are invalid.
Param | Type | Description |
---|---|---|
timeStr | string | The time string (e.g., “09:00” or “2023-10-26T09:00”). |
dayOfWeek | number | The target day of the week (0 for Sunday, 1 for Monday, …, 6 for Saturday). |
Promise.<(string\|null)>
Promise.<(string\|null)>
- A promise that resolves with the JSON string of the schedule, or null if not found.
Param | Type | Description |
---|---|---|
scheduleId | string | The ID of the schedule to export. |
Promise.<(Schedule\|null)>
lastRun
or calculatedWhen
properties.
The imported schedule is added to the existing list of schedules in chrome.storage.sync
.
After successfully saving, it re-registers all alarms.
Kind: global functionPromise.<(Schedule\|null)>
- A promise that resolves with the imported schedule object (with new ID and cleaned properties)
if successful, or null if parsing or validation fails. Rejects on storage error.
Param | Type | Description |
---|---|---|
scheduleJson | string | The JSON string of the schedule to import. |
Promise.<string>
Promise.<string>
- A promise that resolves with the JSON string of all schedules.
Promise.<(Array.<Schedule>\|null)>
chrome.storage.sync
.
Assigns new unique IDs to all imported schedules and removes any existing lastRun
or calculatedWhen
properties.
Basic validation is performed on each schedule; invalid schedules are skipped with a warning.
After successfully saving, it re-registers all alarms.
Kind: global functionPromise.<(Array.<Schedule>\|null)>
- A promise that resolves with the array of successfully validated and imported schedule objects
if successful, or null if the input is not an array or parsing fails. Rejects on storage error.
Param | Type | Description |
---|---|---|
schedulesJson | string | The JSON string of the schedules array to import. |
void
void
Param | Type | Description |
---|---|---|
schedule | Schedule | The schedule object containing an array of URLs to open. |
object
Name | Type | Description |
---|---|---|
id | string | Unique identifier for the schedule. |
name | string | User-defined name for the schedule. |
urls | Array.<string> | List of URLs to open when the schedule runs. |
time | string | Time for the schedule to run. Can be HH:mm or ISO string YYYY-MM-DDTHH:mm. |
repeat | string | How often the schedule repeats (“once”, “daily”, “weekly”). |
[dayOfWeek] | Array.<number> | Days of the week for weekly schedules (0=Sun, 6=Sat). Required if repeat is ‘weekly’. |
[lastRun] | number | Timestamp (ms since epoch) of when the schedule last ran. |
[calculatedWhen] | number | Timestamp (ms since epoch) calculated for the next run of a “once” schedule. |