Notes to myself

John Bieling edited this page Nov 1, 2018 · 4 revisions


  • what about changelog? -> it gets cleared if a target is deleted, or if it is taken offline
  • what about write/save of TbSync data (accounts, folders, changelog)? -> each write cmd actually is a write request which schedules an async write after 6s and each write request resets the write timer, so multiple write requests are merged into one final write request, on exit (unload of messenger) all write timers are reset and a final async write is initiated, onbeforeunload did not work with Linux TB, so using onunload to trigger
  • what about updating an non-existing folder? -> we could resync everything but that might be an overkill, I just use the information of the update request and add the missing folder as not selected (selecting it will initiate the actual sync)
  • what about subfolders (parent != 0)? -> all subfolders are shown as flat hierarchy, trashed folders handled separately
  • what about adding two jobs shortly after another? -> jobs are added to a queue and processed one after the other, the exact same job cannot be added twice
  • what about resync loop? -> if more then 3 resyncs in a row, TbSync is assumed to be unable to recover from some unknown error and stops, user must disconnect and start clean
  • what about resyncing with unsynced changes? -> during hierarchy resync, local folder information is replaced by server information but targets are kept, if the id does not change (as with horde)


  • explicitly use if (error !== "") not if (error) - fails on "0" and ""
  • loop over all properties when card copy
  • do not use add + modify trick, but a true add, so we can cope with any add
  • Link calendar sync to lightning-sync-button using providerId
  • better separate global strings and functions from EAS provider strings and functions

Example Code

           let event = cal.createEvent();
            event.icalString = "BEGIN:VEVENT\n" + 
                "DTSTART:" + dtstart + "\n" + 
                "RRULE:" + rrule + "\n" + 

            let nowDate = new Date();
            let firstDayOfYear = cal.createDateTime(nowDate.getFullYear() + "0101");
            let switchdate = event.recurrenceInfo.getNextOccurrence(firstDayOfYear).recurrenceId;
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.