mysql和IndexedDB之间的同步

jexiocij  于 12个月前  发布在  IndexedDB
关注(0)|答案(1)|浏览(190)

我喜欢使用nw.js(node-webkit)或Electron开发桌面应用程序。
我正在寻找一个解决方案,通过Restful API在云上IndexedDB和MySQL Server + PHP(Laravel)之间同步。
PouchDB看起来不错,但这是出于选择,因为它只支持与CouchDB同步。
我有什么选择?

332nm8kg

332nm8kg1#

用dexie是可能的,但不像用pouchdb那样完整。使用dexie最接近完整解决方案的方法是使用Dexie.Syncable插件(https://dexie.org/docs/Syncable/Dexie.Syncable.js),并从以下2个后端示例实现中实现后端:
https://github.com/dfahlander/Dexie.js/tree/master/samples/remote-sync/
如果你不想依赖Dexie.syncable,另一个解决方案是基于Dexie在其默认API中提供的稳定的CRUD钩子构建自己的同步插件:
https://dexie.org/docs/Table/Table.hook('creating')
https://dexie.org/docs/Table/Table.hook('updating')
https://dexie.org/docs/Table/Table.hook('deleting')
使用这些钩子,可以将所有本地更改记录到专用表中,以便在服务器联机时与服务器同步。这就是Dexie Syncable的基础

相关问题