Which (if any) Javascript storage API (Google Drive, Dropbox, OneDrive) provides automatic syncing?

I have an application that was developed using HTML and javascript. What I need now is to make use of a cloud storage system to access a user's files, which could either be using Google Drive, OneDrive or Dropbox.

One of the requirements is that the application should sync so that new files are added automatically and deleted files removed etc. The sync should be automatic, and there should be no need to poll for changes in the code "manually".

I have determined (as far as I can tell) that with the Dropbox Javascript API, you have to poll for changes and then pull the changes. It seems also with the Google Drive Javascript API that you need to watch for changes and then get those changes. I was leaning towards using OneDrive, but my big problem with that API is that you can (well, so it seems) only access files through a file picker, and I need to get the files without involving the user.

Can anyone confirm the above?

If not, if you need to poll for changes, which would be the best API to use?

And just if anyone has an idea, how often should this be done, and where in the code? Is there some sort of guideline for this?

Answers


You can get properties for Files and Folders without the need of the file picker.

File and folder properties (Windows Runtime apps using JavaScript and HTML)

The user will need to authentic with the service as well as grant consent for your application access to their data. Other than that there would be no user interaction required.

You can also use the REST Api's directly once authenticated and granted access. The REST API's are documented here.

Using the REST API

As for the polling interval I might consider using an "observer" design pattern. You're cloud storage system component would register with the "provider" (the parent HTML application) for notifications. You could call the "sync" logic to execute when a predefined operation occurred such as login. You could persist the modified date time your applications root data folder. Then only look for changes in the event of that miss match.

Polling at a given time frequency will only ensure that the data is in sync at that specific time. The user sync state may or may not be valid when they access your application regardless of what frequency you put on the polling method.


Regarding the Dropbox API at least, this is correct. Using the Dropbox JavaScript SDK you need to poll for changes and then pull those changes into your app's local state.


Need Your Help

Assigning retained object to __unsafe_unretained variable , but why don't it crash?

ios iphone automatic-ref-counting

As far as I know str1 is released after assignment. I just receive warning but why don't it crash?

vb.net + webbrowser/webkitbrowser + collada viewer

vb.net html5 collada

I am currently working on a vb.net application (winforms) and my task is to somehow import collada files(.dae) files and make them viewable from inside the application.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.