This file contains hidden or 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) { | |
if (obj instanceof Backbone.Collection) { | |
obj.on('add remove reset', function () {callback(obj);}); | |
} else if(obj.get(keypath) instanceof Backbone.Collection) { | |
obj.get(keypath).on('add remove reset', function (m,v) {callback(obj.get(keypath));}); | |
} else { | |
obj.on('change:' + keypath, function (m, v) {callback(v)}); | |
} |