From 40a8f0fc8b16b0a8d09ced81642896a5644dd716 Mon Sep 17 00:00:00 2001 From: io-eric Date: Wed, 1 Jul 2026 03:55:27 +0200 Subject: [PATCH 1/2] Add localStorage commands for getting and setting items --- schema.def | 1 + 1 file changed, 1 insertion(+) diff --git a/schema.def b/schema.def index 646f8d8..070cb3a 100644 --- a/schema.def +++ b/schema.def @@ -147,6 +147,7 @@ system|command|INIT_VISIBILITY_CHANGE|init_visibility_change||{ document.addEven # STORAGE (LocalStorage) # ------------------------------------------------------------------------------ storage|command|SET_ITEM|set_item|string:key string:value|{ localStorage.setItem(key, value); } +storage|command|GET_ITEM|get_item|string:key RET:string|{ const ret = localStorage.getItem(key) || ""; } storage|command|REMOVE_ITEM|remove_item|string:key|{ localStorage.removeItem(key); } storage|command|CLEAR|clear||{ localStorage.clear(); } From b9a56a74c369dfc89b2bb0ffb194bf049b068076 Mon Sep 17 00:00:00 2001 From: io-eric Date: Wed, 1 Jul 2026 03:56:58 +0200 Subject: [PATCH 2/2] Add documentation for `get_item` function in Storage API --- docs/api/storage.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/api/storage.md b/docs/api/storage.md index ba490d1..c2bf7a7 100644 --- a/docs/api/storage.md +++ b/docs/api/storage.md @@ -18,6 +18,15 @@ Saves a key-value pair to local storage. void set_item(webcc::string_view key, webcc::string_view value); ``` +### `get_item` + +Reads a value from local storage by its key. Returns an empty string if the key +does not exist. + +```cpp +webcc::string get_item(webcc::string_view key); +``` + ### `remove_item` Removes an item from local storage by its key.