Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2016 09:01
Show Gist options
  • Save gr2m/5463525 to your computer and use it in GitHub Desktop.
Save gr2m/5463525 to your computer and use it in GitHub Desktop.
Imagine you could share user data with JavaScript right in the browser. How would the code look like? This is what I came up with. Forks & comments much appreciated! (see also: #nobackend #dreamcode
// add a new share
share = new Share()
// grant / revoke access
share.revomeWriteAccess(['', ''])
// add all todo objects to the share
// remove a specific todo from the share
store.find('todo', '123').then(share.remove)
// remove objects from all shares
// remove share
// open a share and load all its objects
share = new Share('shareIdHere')
share.findAll().done( render )
// subscribe: sync changes between local store and remote share
Copy link

aishwar commented Nov 15, 2013

This looks cool. I am curious how would shares work. Would a share just be an object that contains pointers to data objects? Or would the actual data object be copied into the share?

Copy link

in a talk [1] someone from hoodie mentioned that they share the data using filtered replication of couchdb


Copy link

gr2m commented Jan 19, 2015

I've updated the code to be generic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment