const rs = new RemoteStorage();
rs.access.claim('todos', 'rw');
rs.caching.enable();
const client = rs.scope('/todos/');
// Declare an object type to validate if you want (JSON Schema)
client.declareType('todo-item', {});
// Write `{"id":"alfa","done":false}` to /todos/alfa.json
await client.storeObject('todo-item', 'alfa.json', {
id: 'alfa',
done: false,
});
const specificItem = await client.getObject('alpha.json');
const allTodoItems = await client.getAll();
Use our drop-in UI widget for connecting remote storage accounts.
const widget = new Widget(rs);
widget.attach();