Created
September 3, 2012 23:29
-
-
Save sporto/3614806 to your computer and use it in GitHub Desktop.
Rivets adapter for CanJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rivets.configure({ | |
adapter: { | |
subscribe: function(obj, keypath, callback) { | |
callback.wrapped = function(ev, attr, how, newVal, oldVal) { callback(newVal) }; | |
obj.bind('change', callback.wrapped); | |
}, | |
unsubscribe: function(obj, keypath, callback) { | |
obj.unbind('change', callback.wrapped); | |
}, | |
read: function(obj, keypath) { | |
return obj.attr(keypath); | |
}, | |
publish: function(obj, keypath, value) { | |
obj.attr(keypath, value); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment