Update the README with simplified subscribe/unsubscribe implementations in the example adapter.
Showing
1 changed file
with
2 additions
and
3 deletions
... | @@ -43,11 +43,10 @@ Rivets.js is model interface-agnostic, meaning it can work with any event-driven | ... | @@ -43,11 +43,10 @@ Rivets.js is model interface-agnostic, meaning it can work with any event-driven |
43 | rivets.configure({ | 43 | rivets.configure({ |
44 | adapter: { | 44 | adapter: { |
45 | subscribe: function(obj, keypath, callback) { | 45 | subscribe: function(obj, keypath, callback) { |
46 | callback.wrapped = function(m, v) { callback(v) }; | 46 | obj.on('change:' + keypath, callback); |
47 | obj.on('change:' + keypath, callback.wrapped); | ||
48 | }, | 47 | }, |
49 | unsubscribe: function(obj, keypath, callback) { | 48 | unsubscribe: function(obj, keypath, callback) { |
50 | obj.off('change:' + keypath, callback.wrapped); | 49 | obj.off('change:' + keypath, callback); |
51 | }, | 50 | }, |
52 | read: function(obj, keypath) { | 51 | read: function(obj, keypath) { |
53 | return obj.get(keypath); | 52 | return obj.get(keypath); | ... | ... |
-
Please register or sign in to post a comment