Skip to content

storage: getItem returns what setItem stored; storage.onChange - #2

Merged
localrivet merged 1 commit into
mainfrom
feat/storage-onchange
Oct 1, 2026
Merged

localrivet merged 1 commit into
mainfrom
feat/storage-onchange

Conversation

@localrivet

Copy link
Copy Markdown
Contributor
  • getItem decoded the server's value once, so objects and lists came back as JSON text; it now returns exactly what setItem was given (stored bytes unchanged).
  • storage.onChange(cb): hears app_data_changed on the app socket, filtered to this app; source is employee (the app's employee wrote through its app_data tool) or page (another open view). Returns an unsubscribe function.

Checked in node against a stubbed fetch/WebSocket: arrays and numbers round-trip, other apps' changes are ignored, unsubscribe works.

getItem decoded the server's value once, so an object or list came back
as JSON text. It now returns the value setItem was given.

storage.onChange(cb) calls cb({appId, keys, action, source}) on the
app_data_changed event: the app's employee changed the store (app_data),
or another open view did. Returns a function that stops listening.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant