1.0.19 • Published 10 months ago

@xplive/synceddb v1.0.19

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

 

About

Client-side CRUD operations between indexedDB and a server.

Technologies

The following tools were used in this project:

  • idbx - an indexedDB wrapper

Getting started

import * as idbx from "https://deno.land/x/idbx/main.ts";
import { SyncedDB } from "https://deno.land/x/synceddb/main.ts";

// create a database
const dbreq = idbx.open('my-database', 1);

// create a store
dbreq.upgrade((event) => {
  const target = event.target as IDBOpenDBRequest;
  const db = target.result;
  SyncedDB.createStore(db, "mystore");
});

// wait for DB to initialize
const db = await dbreq.ready;

// create a synceddb instance
const syncdb = new SyncedDB(db, "mystore", {
keyName: "id",
  // Default Settings:
  
  // url: location.origin,
  // autoSync: false,
  // createPath: "/api/create",
  // readPath: "/api/read",
  // updatePath: "/api/update",
  // deletePath: "/api/delete",
  // readAllPath: "/api/read_all",
  // syncPath: "/api/sync",
});

const result = await syncdb.create({
  title: "Awesome!",
  description: "Probably a reinvention of the wheel ;-P"
});
// case 1 (online): writes entry into the indexedDB store and send the entry to the server
//                  sync_action: "none", sync_status: "synced"
// case 2 (offline): writes entry into the indexedDB store and creates a temporary ID
//                  sync_action: "create", sync_status: "unsynced"

License

This project is under license from MIT. For more details, see the LICENSE file.

Made by Mario Stöcklein

 

Back to top

1.0.19

10 months ago

1.0.18

10 months ago

1.0.17

10 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago