From 09b01cf869a54f2a55f79ee17ee0b99ff887bd8f Mon Sep 17 00:00:00 2001 From: SharkPool <139097378+SharkPool-SP@users.noreply.github.com> Date: Sun, 19 Jul 2026 22:48:13 -0700 Subject: [PATCH 1/3] local-storage.js -- Add ability to 'get all keys' in local storage Add 'getAll' method to retrieve all keys from storage. --- extensions/local-storage.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/extensions/local-storage.js b/extensions/local-storage.js index 85e02b635e..1a6ea1e1a4 100644 --- a/extensions/local-storage.js +++ b/extensions/local-storage.js @@ -199,6 +199,12 @@ }, }, }, + { + opcode: "getAll", + blockType: Scratch.BlockType.REPORTER, + text: Scratch.translate("all keys from storage"), + disableMonitor: true, + }, { opcode: "removeAll", blockType: Scratch.BlockType.COMMAND, @@ -258,6 +264,14 @@ saveToLocalStorage(); } + getAll() { + if (!validNamespace()) { + return ""; + } + + return JSON.stringify(Object.keys(namespaceValues)); + } + removeAll() { if (!validNamespace()) { return ""; From a1df6637d931d0f4089db81175cca207942a8ef4 Mon Sep 17 00:00:00 2001 From: "DangoCat[bot]" Date: Mon, 20 Jul 2026 05:50:55 +0000 Subject: [PATCH 2/3] [Automated] Format code --- extensions/local-storage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/local-storage.js b/extensions/local-storage.js index 1a6ea1e1a4..3a67b4935b 100644 --- a/extensions/local-storage.js +++ b/extensions/local-storage.js @@ -269,7 +269,7 @@ return ""; } - return JSON.stringify(Object.keys(namespaceValues)); + return JSON.stringify(Object.keys(namespaceValues)); } removeAll() { From 9148f66b2134c3dd5599e22d20f0b8e677483456 Mon Sep 17 00:00:00 2001 From: SharkPool <139097378+SharkPool-SP@users.noreply.github.com> Date: Sun, 19 Jul 2026 22:52:35 -0700 Subject: [PATCH 3/3] Document method to retrieve all keys from storage Added a note on retrieving all keys from local storage. --- docs/local-storage.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/local-storage.md b/docs/local-storage.md index 0151ef86a2..bf830338c7 100644 --- a/docs/local-storage.md +++ b/docs/local-storage.md @@ -44,6 +44,12 @@ Or delete everything stored in the namespace: delete storage :: #0FBD8C ``` +If you ever loose track of what variables you previously set in storage, you can use the below block. It will return an array of all variables (or 'keys') in storage. + +```scratch +(all keys from storage :: #0FBD8C) +``` + ## Performance The local storage extension is inevitably slower than regular variables.