使用服务器端同步的客户端存储的javascript库

时间:2021-12-28 15:46:55

I'm looking for a javascript library that will let me store data in a client side database and in the back ground automatically sync the database back to the server's database

我正在寻找一个javascript库,它可以让我在客户端数据库中存储数据,并在后台自动将数据库同步回服务器的数据库

preferable something that supports a variaty of engines in the same way jStore for jQuery does

更好的方法是支持各种引擎,就像jStore支持jQuery一样

Looking around I can find anything

环顾四周,我能找到任何东西

9 个解决方案

#1


3  

Store.js deal with the client-side storage very well. Note that it supports IE6+ along with other browsers. For the server-side storage you might as well make your own script for that as it should not be difficult.

商店。js处理客户端存储非常好。注意,它支持IE6+以及其他浏览器。对于服务器端存储,您也可以为此编写自己的脚本,因为这应该不难。

#2


3  

Since this question was asked, there's been a lot of work done on local storage and client side databases.

自从这个问题被提出以来,本地存储和客户端数据库已经做了很多工作。

There's a great overview of local storage options at Dive Into HTML5.

在深入HTML5时,对本地存储选项有一个很好的概述。

There are also several cross-platform JavaScript storage libraries available, including Lawnchair and persistence.js.

还有一些跨平台的JavaScript存储库可用,包括Lawnchair和persistence.js。

#3


1  

Iam not 100% sure, but i think there isnt such a framework. I would recommend to have a look on Google Gears.

我不是百分之百确定,但我认为没有这样一个框架。我建议您看看谷歌档。

Google Gears supports offline storage on client side.

谷歌Gears支持客户端离线存储。

Another approach would be to check out the sourcecode of TidlyWiki. They have created an wiki system wich stores all data on client side.

另一种方法是检查TidlyWiki的源代码。他们创建了一个wiki系统,在客户端存储所有数据。

#4


1  

I'm not aware of any library that does that nowadays. Even tough this is a possible idea, I must say that I'm not sure if making such library is a good effort.

我不知道现在有哪个图书馆会这么做。即使这是一个可能的想法,我必须说我不确定建立这样的库是否是一个好的努力。

It would have to provide examples of how to expose your server data to the library, how to calculate deltas, and so on. This would force the developer to change this server side code accordingly to the library's protocol. This could be great for new apps and websites, but this could be a pain to any existing site, with particular data structure, making the effort to implement this not so much preferable to developing your own Javascript to do that with current data already exposed by the app. All of these on top of potential security problems would be kinda hard to manage in one generic javascript library.

它必须提供如何向库公开服务器数据、如何计算增量等示例。这将迫使开发人员将服务器端代码相应地更改为库的协议。这可能是伟大的新应用程序和网站,但这可能是一个痛苦的任何现有的网站,与特定的数据结构,努力实现这个与其说比开发自己的Javascript使用当前数据已经公开的应用。所有这些之上的潜在的安全问题将会在一个通用的Javascript库有点很难管理。

IMHO this is a great idea to make bundles or plugins to specific ORM based MVC frameworks, for example Ruby on Rails or Django. Since the framework itself has an abstraction to the data structure and many security fixes already bundled together, making a bundle to do that would be much more re-usable and more elegant.

IMHO是一个很好的想法,可以将bundle或插件包到特定ORM的MVC框架中,例如Ruby on Rails或Django。由于框架本身具有对数据结构的抽象,并且已经绑定在一起的许多安全补丁,因此将其打包,将更加可重用和更加优雅。

#5


1  

Just stumbled across this question; for posterity, CouchDB and CouchBase are designed for this:

刚遇到这个问题;为了子孙后代,CouchDB和CouchBase是为此而设计的:

http://couchdb.apache.org/

http://couchdb.apache.org/

The JavaScript client:

JavaScript客户端:

https://pouchdb.com/

https://pouchdb.com/

And CouchBase:

和他:

https://www.couchbase.com/

https://www.couchbase.com/

Finally, CouchBase Lite/Mobile:

最后,他Lite /手机:

https://www.couchbase.com/products/lite

https://www.couchbase.com/products/lite

The latter gets you native CouchDB/CouchBase synchronization.

后者获取本地CouchDB/CouchBase同步。

In all cases you just access the local database and it can synchronize if and when you connect to the internet.

在所有情况下,您只需访问本地数据库,它就可以在您连接到internet时进行同步。

#6


0  

I've been doing some work on this. It seems to be almost possible using Google Documents. Most of the APIs are accessible via Javascript. Unfortunately the exceptions include things like upload and download, so while it's possible to enumerate documents, create files, change metadata etc all from inside the browser, actually getting at the data is a lot harder.

我一直在研究这个。使用谷歌文档似乎几乎是可能的。大多数api都可以通过Javascript访问。不幸的是,这些例外包括上传和下载,所以虽然可以枚举文档、创建文件、修改元数据等等,但实际上获取数据要困难得多。

Google Spreadsheets do have Javascript APIs for accessing individual cells, so it's theoretically possible to store your data in a spreadsheet. Unfortunately there's another whole in the API where it seems to be rather hard to write data to a cell that previously did not have data in it, which means that once you've created your empty spreadsheet, you can't populate it...

谷歌电子表格确实有用于访问单个单元的Javascript api,因此理论上可以将数据存储在电子表格中。不幸的是,API中还有另一个整体,似乎很难将数据写到以前没有数据的单元格中,这意味着一旦创建了空电子表格,就无法填充它……

#7


0  

As far as I know Safari, Chrome, and Opera all based on SQLite. SQLite has a .dump command which is not only great to restore a database but to sync with another database. Therefore, it may be possible to call this from the Javascript Database using .dump, and if necessary, modify the dump and upload it to the server database to execute.

据我所知,Safari、Chrome和Opera都是基于SQLite的。SQLite有一个.dump命令,它不仅可以恢复数据库,还可以与另一个数据库同步。因此,可以使用.dump从Javascript数据库调用它,如果需要,可以修改转储并将其上载到服务器数据库以执行。

However, you will want to be careful of SQL injection attempts.

但是,您需要小心SQL注入尝试。

#8


0  

Did you try jsonengine?

你试过jsonengine吗?

Not sure how much this project is alive but this answers all yor requirments.

不知道这个项目有多少是活的,但它满足了你所有的要求。

#9


0  

Firebase does this, although it is not a relational model

尽管它不是一个关系模型,但是Firebase做到了这一点

#1


3  

Store.js deal with the client-side storage very well. Note that it supports IE6+ along with other browsers. For the server-side storage you might as well make your own script for that as it should not be difficult.

商店。js处理客户端存储非常好。注意,它支持IE6+以及其他浏览器。对于服务器端存储,您也可以为此编写自己的脚本,因为这应该不难。

#2


3  

Since this question was asked, there's been a lot of work done on local storage and client side databases.

自从这个问题被提出以来,本地存储和客户端数据库已经做了很多工作。

There's a great overview of local storage options at Dive Into HTML5.

在深入HTML5时,对本地存储选项有一个很好的概述。

There are also several cross-platform JavaScript storage libraries available, including Lawnchair and persistence.js.

还有一些跨平台的JavaScript存储库可用,包括Lawnchair和persistence.js。

#3


1  

Iam not 100% sure, but i think there isnt such a framework. I would recommend to have a look on Google Gears.

我不是百分之百确定,但我认为没有这样一个框架。我建议您看看谷歌档。

Google Gears supports offline storage on client side.

谷歌Gears支持客户端离线存储。

Another approach would be to check out the sourcecode of TidlyWiki. They have created an wiki system wich stores all data on client side.

另一种方法是检查TidlyWiki的源代码。他们创建了一个wiki系统,在客户端存储所有数据。

#4


1  

I'm not aware of any library that does that nowadays. Even tough this is a possible idea, I must say that I'm not sure if making such library is a good effort.

我不知道现在有哪个图书馆会这么做。即使这是一个可能的想法,我必须说我不确定建立这样的库是否是一个好的努力。

It would have to provide examples of how to expose your server data to the library, how to calculate deltas, and so on. This would force the developer to change this server side code accordingly to the library's protocol. This could be great for new apps and websites, but this could be a pain to any existing site, with particular data structure, making the effort to implement this not so much preferable to developing your own Javascript to do that with current data already exposed by the app. All of these on top of potential security problems would be kinda hard to manage in one generic javascript library.

它必须提供如何向库公开服务器数据、如何计算增量等示例。这将迫使开发人员将服务器端代码相应地更改为库的协议。这可能是伟大的新应用程序和网站,但这可能是一个痛苦的任何现有的网站,与特定的数据结构,努力实现这个与其说比开发自己的Javascript使用当前数据已经公开的应用。所有这些之上的潜在的安全问题将会在一个通用的Javascript库有点很难管理。

IMHO this is a great idea to make bundles or plugins to specific ORM based MVC frameworks, for example Ruby on Rails or Django. Since the framework itself has an abstraction to the data structure and many security fixes already bundled together, making a bundle to do that would be much more re-usable and more elegant.

IMHO是一个很好的想法,可以将bundle或插件包到特定ORM的MVC框架中,例如Ruby on Rails或Django。由于框架本身具有对数据结构的抽象,并且已经绑定在一起的许多安全补丁,因此将其打包,将更加可重用和更加优雅。

#5


1  

Just stumbled across this question; for posterity, CouchDB and CouchBase are designed for this:

刚遇到这个问题;为了子孙后代,CouchDB和CouchBase是为此而设计的:

http://couchdb.apache.org/

http://couchdb.apache.org/

The JavaScript client:

JavaScript客户端:

https://pouchdb.com/

https://pouchdb.com/

And CouchBase:

和他:

https://www.couchbase.com/

https://www.couchbase.com/

Finally, CouchBase Lite/Mobile:

最后,他Lite /手机:

https://www.couchbase.com/products/lite

https://www.couchbase.com/products/lite

The latter gets you native CouchDB/CouchBase synchronization.

后者获取本地CouchDB/CouchBase同步。

In all cases you just access the local database and it can synchronize if and when you connect to the internet.

在所有情况下,您只需访问本地数据库,它就可以在您连接到internet时进行同步。

#6


0  

I've been doing some work on this. It seems to be almost possible using Google Documents. Most of the APIs are accessible via Javascript. Unfortunately the exceptions include things like upload and download, so while it's possible to enumerate documents, create files, change metadata etc all from inside the browser, actually getting at the data is a lot harder.

我一直在研究这个。使用谷歌文档似乎几乎是可能的。大多数api都可以通过Javascript访问。不幸的是,这些例外包括上传和下载,所以虽然可以枚举文档、创建文件、修改元数据等等,但实际上获取数据要困难得多。

Google Spreadsheets do have Javascript APIs for accessing individual cells, so it's theoretically possible to store your data in a spreadsheet. Unfortunately there's another whole in the API where it seems to be rather hard to write data to a cell that previously did not have data in it, which means that once you've created your empty spreadsheet, you can't populate it...

谷歌电子表格确实有用于访问单个单元的Javascript api,因此理论上可以将数据存储在电子表格中。不幸的是,API中还有另一个整体,似乎很难将数据写到以前没有数据的单元格中,这意味着一旦创建了空电子表格,就无法填充它……

#7


0  

As far as I know Safari, Chrome, and Opera all based on SQLite. SQLite has a .dump command which is not only great to restore a database but to sync with another database. Therefore, it may be possible to call this from the Javascript Database using .dump, and if necessary, modify the dump and upload it to the server database to execute.

据我所知,Safari、Chrome和Opera都是基于SQLite的。SQLite有一个.dump命令,它不仅可以恢复数据库,还可以与另一个数据库同步。因此,可以使用.dump从Javascript数据库调用它,如果需要,可以修改转储并将其上载到服务器数据库以执行。

However, you will want to be careful of SQL injection attempts.

但是,您需要小心SQL注入尝试。

#8


0  

Did you try jsonengine?

你试过jsonengine吗?

Not sure how much this project is alive but this answers all yor requirments.

不知道这个项目有多少是活的,但它满足了你所有的要求。

#9


0  

Firebase does this, although it is not a relational model

尽管它不是一个关系模型,但是Firebase做到了这一点