bruth/synapse — Issue #21: Allow syncWith() to specify interfaces
Author: dbushong
Created: 2012-01-21 20:35:11+00:00
State: open

Currently `syncWith()` takes no options, AFAICT. (Contradicting the docs, BTW)

It would be nice to be able to bidirectionally link two objects that don't share the same interface. Unfortunately, the obvious method for doing this, passing an object with `observerInterface` and `subjectInterface` wouldn't help because they switch roles. However, it's entirely possible (likely?) that the interface for each specific object would stay the same for both directions, we just need a way of specifying them, but I'm not sure the best way to do that.. `leftInterface` and `rightInterface` ? Blech.

Example:

```javascript
var a = Synapse($('#foo')), b = Synapse(new Backbone.Model());

// tedious
a.observe(b, 'some_prop_on_b', 'attr.some_attr_on_a')
.notify(b, 'attr.some_attr_on_a', 'some_prop_on_b');

// better?
a.syncWith(b, { leftInterface: 'attr.some_attr_on_a', rightInterface: 'some_prop_on_b' });

// a.k.a.
a.syncWith(b, 'attr.some_attr_on_a', 'some_prop_on_b');
```