javascript library for client side storage with server side sync [closed]
开发者_如何转开发
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this questionI'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
preferable something that supports a variaty of engines in the same way jStore for jQuery does
Looking around I can find anything
Just stumbled across this question; for posterity, CouchDB and CouchBase are designed for this:
http://couchdb.apache.org/
The JavaScript client:
https://pouchdb.com/
And CouchBase:
https://www.couchbase.com/
Finally, CouchBase Lite/Mobile:
https://www.couchbase.com/products/lite
The latter gets you native CouchDB/CouchBase synchronization.
In all cases you just access the local database and it can synchronize if and when you connect to the internet.
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.
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.
There are also several cross-platform JavaScript storage libraries available, including Lawnchair and persistence.js.
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.
Another approach would be to check out the sourcecode of TidlyWiki. They have created an wiki system wich stores all data on client side.
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.
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.
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.
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...
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.
However, you will want to be careful of SQL injection attempts.
Did you try jsonengine?
Not sure how much this project is alive but this answers all yor requirments.
Firebase does this, although it is not a relational model
精彩评论