Trying to take it offline (0.6)

69 views
Skip to first unread message

Arnaud Rinquin

unread,
Oct 31, 2013, 9:21:35 AM10/31/13
to sha...@googlegroups.com
Hi guys!

I use ShareJS to make a nice 'medium.com-like' ShareJS editor (using AngularJS). The editor is running fine but I need to make it work offline. By offline I mean use AppCache to store the editor code and localStorage to persist data between page reload.

My strategy for this is to build an operation queue that would be applied on demand (ie: getting back online) instead of after every keystroke. This queue and document refs (docName, version) are persisted on the localStorage.

What I already achieved (or am about to):
  • Wrote another implementation of the attach_text so I can hook were I need to
  • Store latest version of the document (snapshot, version, docname)
  • Store every pending operation in localStorage
What I can't figure out:
  • Apply the queued operations that were made in the backed up version
    • I start from nothing but what I stored in localStorage
    • If I get the current document from ShareJS, it will be the newer version : my backed up operations would have to be transformed before applying them, can I do that?
    • I think I should send queued operations in the older version behalf. How can I do that?
Any idea?


Reply all
Reply to author
Forward
0 new messages