I am working on a Spine App that users rivets js in lieu of a templating engine and so far I am delighted with the rivets bindings, my views are more concise and readable and I have a clean separation of concerns: my controllers only take care of managing the state of the app, my models do the persistence stuff and my custom rivet bindings and formatters take care of formatting values and massaging user input. So far so good.
My only concern is that I am using watch.js and I suspect watch is responsable for iphone performance issues, and I not too comfortable using it.
In rivets js site it states that it has support for Spine although I haven't been able to find a single example let alone a snippet.
The only adapter that works both for controllers and models I could come up with is this:
rivets.configure adapter:
subscribe: (obj, keypath, callback) ->
watch obj, keypath, callback
unsubscribe: (obj, keypath, callback) ->
unwatch obj, keypath, callback
read: (obj, keypath) ->
obj[keypath]
publish: (obj, keypath, value) ->
obj[keypath] = value
Is there a better way to binding rivets to spine models and controllers?
I've been struggling with Object.defineProperty to no avail.