Keep a record in the kit
Reads, saves, deletes or lists the records a Site Kit keeps (notes, counts, what you saw last), shared with the kit's pages in every browser.
op key in collection
Details #
A Site Kit keeps its own records in Switchboard, not in the website. Each record has a collection (a group, like notes), a key and a value (text, a number, a list or a record). A kit's pages read and write the same records with kit.store, and a change shows up at once in every open tab of the kit, in every connected browser.
getreads the record atkey(nothing if there is none).putsavesvalueatkey.deleteremoves the record.querylists the records of the collection, in key order, as{key, value}.prefixkeeps only keys that start with it.
kit is the kit's id (kit.github-plus); leave it out for the kit this macro is in. A value can be up to 1 MB and a collection holds up to 10,000 records. Collections that start with __ belong to the kit itself and can't be changed here.
The kit's settings are not records: read them in any text with {{ kit.setting.compact }}.
Records stay when the kit is turned off or updated. They are deleted only with the kit, after Switchboard has said how many there are.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
collection | text | , key, value, prefix: What to read or save. | ||
into | text | The variable that receives the result: the value, true, or the list of {key, value}. | ||
key | text | |||
kit | text | Which kit. Default: the kit this macro is in. | ||
op | one of | get put delete query | get, put, delete or query. | |
prefix | text | |||
sample | any value | |||
value | any value |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Save “pr-12” to “notes”
- Read “pr-12” from “notes”
Gotchas #
A macro outside a Site Kit has to name the kit with
kit.A
putpast 1 MB or 10,000 records fails and says which limit it hit.