feat(plugins): notify extensions of settings changes

This commit is contained in:
tianma-if committed 2026-09-08 19:29:50 +08:00
1 parent 87a6e64a6d
commit 72d655a109
7 files changed
+64 -6

No files matched your search

+10
View File
@@ -307,6 +307,16 @@ await context.settings.set("format", "html");
await context.settings.remove("token");
```
Plugins can listen for changes to their own settings and then read the host-validated value again. The event is delivered only to the plugin that owns the setting and does not include the value, keeping secrets and other configuration out of event payloads:
```ts
context.events.on("settings.changed", async ({ key }) => {
if (key !== "format") return;
const format = await context.settings.get("format");
// Apply the updated format.
});
```
## Storage and network
Plugin storage is namespaced by EdgeEver workspace and plugin ID: