notesy::store
What a plugin keeps between runs: counts, caches, what it last synced. It's the plugin's own, private to it, and needs no permission.
rustuse notesy::store;
pub fn ready() {
let saves = store::get("saves").unwrap_or(0);
store::set("saves", saves + 1);
store::set("last", #{ note: "Daily/today.md", at: 1757700000 });
store::remove("last");
}
| Function | What it does |
|---|---|
store::get(key) |
What it kept under key: Some(value), or None. |
store::set(key, value) |
Keeps value under key, and writes the store. |
store::remove(key) |
Forgets what it kept under key. |
#What can be kept
true and false, integers, floats, strings, and vectors and objects of
those. Anything else (a function, a struct of the script's own) is an
error: a Function can't be kept.
Keys are the plugin's to choose. The whole store holds at most 1 MiB; a
set that would pass that is an error, and the store stays as it was.
#Where it lives
plugin-data/<id>/store.toml in notesy's config folder, beside (not
inside) the plugin's folder, so an update keeps it. The same file holds the
values of its settings (notesy::settings), which the settings page
writes; store::set reads the file again before writing it, so what the
user set there is never lost.
If the file can't be read (it was edited by hand, say), the plugin doesn't start rather than write over it.
Every page
- Overview
- plugin.toml: Every field of plugin.toml
- Permissions: What a plugin can ask for, when notesy asks, and what changes it
- Scripts: How a script runs: its lifecycle, events, limits and errors
- Packing and installing: Making, checking, signing, packing and installing
- notesy::log: Lines for its log on the Plugins page
- notesy::events: Hearing what happens, and every event
- notesy::commands: Adding commands, and running notesy's
- notesy::store: Keeping its own data
- notesy::settings: Reading its settings
- notesy::secrets: Keys and tokens, in the system keychain
- notesy::notes: Reading and changing the vault's notes
- notesy::editor: The note in front
- notesy::templates: What templates fill in, and functions of its own for them
- notesy::files: A folder of its own
- notesy::links: Opening pages in the browser, naming links after their pages
- notesy::clipboard: Copying and pasting
- notesy::view: What panels, tabs and sections show
- notesy::sections: Sidebar sections
- notesy::hidden: Hiding notes, files and folders from the tree
- notesy::status: Status bar items
- notesy::tools: Buttons in the formatting bar
- notesy::notices: Notices
- notesy::dialogs: Asking in a dialog, notesy's kinds or its own
- notesy::wizards: Pages one after another, like a setup
- notesy::boards: Boards' cards and arrows, and kinds of card of its own
- notesy::blocks: Drawing its fenced blocks
- notesy::icons: Drawing its own icons
- notesy::net: Requests to the sites it names
- notesy::ipc: Talking to a program on this computer
- notesy::accounts: Signing in to a service
- notesy::json: Reading and writing JSON
- notesy::toml: Reading and writing TOML
- notesy::yaml: Reading and writing YAML, and a note's front matter
- notesy::time: Now, written in the user's time zone, dates read, how long ago
- notesy::math: Trigonometry and the like, for drawing
- Names: Icon, Color, Tone, Side, Method, Command, Zone, Event: Notesy's names as enums
- notesy::preview: Its own screens for notesy preview
- notesy::perf: Timing its own work
- notesy::drawings: Drawings' shapes, and buttons in their tool strip
- notesy::sound: Playing sounds, and making them as it runs
- notesy::tex: Math macros for every note's formulas
- notesy::views: Side panels, tabs of its own, and its part of the tree's hover cards
- notesy::zones: Notesy's own places — its menus, its bars and its headings