steveluscher / knockout.meteor

A Knockout-to-Meteor bridge
http://steveluscher.github.com/knockout.meteor
MIT License
66 stars 10 forks source link

Implement reverse synchronization (from Knockout -> Meteor) #1

Open steveluscher opened 12 years ago

steveluscher commented 12 years ago

As pointed out in the example, syncing back to the Meteor Collection has to be done manually. A custom mapping was built to update the Meteor Collection when a Knockout Observable changed:

// This custom mapping adds a callback to a todo's "done" observable.
// The callback watches for changes in the "done" property, and syncs
// them back into the Meteor model.
//
// This reveals a weakness in the current implementation of Knockout Meteor;
// syncing from Meteor->Knockout happens automatically, but syncing back
// from Knockout->Meteor has to be configured manually.
//
// This is both good (you probably want to manage when data is synced back
// to the database) and bad (you have to write the reverse sync code), but
// there's probably a way to implement automatic syncing in both directions
// while still offering enough control over what synced and when.
//
// That's your cue to close the loop and send us a pull request!

I welcome your ideas and implementations.

dotnetwise commented 10 years ago

+1