Storage adapter interface and local storage adapter
Defines a small asynchronous StorageAdapter contract with load, save, remove and list operations, and ships a built-in adapter for browser local and session storage. The built-in adapter supports namespaced keys, size guarding and graceful degradation when storage is unavailable.
Planned. This page shows the specification from issue #201. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid persisted to local storage under the key 'warui-demo:orders'.
Expected behavior
Reloading the demo iframe restores the layout. Switching to session storage limits persistence to the current tab. A simulated quota error is reported through onAutoSaveError while the grid keeps working.
Planned API surface
StorageAdaptercreateLocalStorageAdapter({key, namespace, storage})adapter.loadadapter.saveadapter.removeadapter.listAcceptance criteria
- The adapter contract is Promise-based, and synchronous storage is wrapped. (pending)
- Keys are namespaced to avoid collisions between multiple grids on the same page. (pending)
- QuotaExceededError is caught and reported, and the grid never crashes. (pending)
- When storage is inaccessible (for example, private mode), the adapter falls back to in-memory storage and emits a warning. (pending)
- Changes made to the same key in another tab can be observed through an optional cross-tab sync setting. (pending)