indexeddbshim / IndexedDBShim

A polyfill for IndexedDB using WebSql
Other
967 stars 191 forks source link

Is this library working with Electron? #357

Closed ivanjeremic closed 4 years ago

ivanjeremic commented 4 years ago

Is this library working with Electron, What I mean by that is when I have a server-side (Node) code that saves data to the DB, will it be saved in the Electron window IndexedDB?

brettz9 commented 4 years ago

No. You could in theory serialize IndexedDB stored on the client or server (whether native IndexedDB in Electron or IndexedDBShim on Node), such as IndexedDBShim does internally (i.e., use encode in the file src/Sca.js which uses typeson-registry with the structured cloning preset to produce a JSON serialization) and then optionally diff the current serialization against the one known to be on the client or server (e.g., by using JSON Patch) and then send the diff or whole JSON serialization from client to server or vice versa, parse it back into JavaScript objects, (as with decode in src/Sca.js), and then replace the store or part of the store with the parsed result.

However, IndexedDBShim doesn't provide any utilities to do such transmission or syncing between client/server.

Closing as that essentially answers it, but feel free to comment further as needed.