Backbone.SharedCollection is collection that listens to all changes events of the models within the collection and saves the changes to a ShareJS document. It also listens events coming from ShareJS and reflects them to models. Neat thing about this is that no special code is required for the models. They just automatically get synced between all browser instances when they are added to the collection.
ShareJS also supports Redis as persistence option. So this also gives persistence for Backbone Models for free which is great when building prototypes. Just build client only prototype with Backbone and when you need synchronization and persistence you can just drop Backbone.SharedCollection in and you are set.
For more information and API docs checkout README.md in Github.
ShareJS supports text operatios within string fields in JSON documents. It would be cool to build Backbone Model where a field could act as storage for mini etherpads.
In Pahvi we have editable Text Boxes and currently the text and text style attributes are stored as attributes in a Backbone Model. For style attributes this works great since it’s ok to allow latest update to override previous, but for text this is problematic. Users will lose data when editing the same Text Box concurrently. It would be ideal if we could keep this Model abstraction over the Text Box data and allow Etherpad style editing to it.
Ideas and comments about this would be very welcome.
Rich text support is also something were are hoping to see in ShareJS soon 🙂