mysql和IndexedDB之间的同步

问题描述 投票:0回答:1

我喜欢使用 nw.js (node-webkit) 或 Electron 开发桌面应用程序。

我正在寻找一种通过 Restful API 在云上的 IndexedDB 和 MySQL Server + PHP(Laravel) 之间同步的解决方案。

PouchDB 看起来不错,但这是不可能的,因为它只支持与 CouchDB 同步。

我有什么选择?

javascript php indexeddb pouchdb dexie
1个回答
1
投票

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('创建')

https://dexie.org/docs/Table/Table.hook('更新')

https://dexie.org/docs/Table/Table.hook('删除')

使用这些钩子,可以将所有本地更改记录到专用表中,以便在服务器上线时与服务器同步。这就是 Dexie.Syncable 的基础。

© www.soinside.com 2019 - 2024. All rights reserved.