All changes at once


ah right. yes, there’s no event for that, might be worth introducing.

last time i tested with my messaging app it received 2000 local events in 8 seconds, so yes it does become quite slow when you start using it for anything more serious.

especially if you want one small specific item, which would have been superquick to fetch in 0.8.3 and now have to wait for all the other events to come by…


If you want a specific item you can use getObject and that should fetch that one first and fulfill the promise as soon as it’s fetched instead of waiting for the whole tree to be synced.


actually it’s not as slow as that by itself, of course it gets slower if you for instance call console.log for each local change event.

FWIW, I’m now using the following code as a work-around for this issue:

var timer;
remoteStorage.scope('/').on('change', function() {
  if(timer) {
  timer = setTimeout(function() {
  }, 250);

Here showEmail() is the function which will only work after the relevant local events have all been fired.

The remoteStorage.scope('/') is an insider trick to get a baseclient without defining a module :wink:


How do you know the “relevant” events have been fired? Why 250 ms?


Continued here:

remoteStorage.sync's “done” event seems to do what I want.