fb5ebc1a by Michael Richards

Fix typo in object iteration. Add conditional when setting the binder data (conf…

…ig option for preloadData).
1 parent 750bf3ef
......@@ -33,7 +33,10 @@
Binding.prototype.bind = function() {
var _ref,
_this = this;
this.set() && this.adapter.subscribe(this.context, this.keypath, function(value) {
if (Rivets.config.preloadData) {
this.set();
}
this.adapter.subscribe(this.context, this.keypath, function(value) {
return _this.set(value);
});
if (_ref = this.type, __indexOf.call(bidirectionals, _ref) >= 0) {
......@@ -113,13 +116,13 @@
rivets = {
configure: function(options) {
var property, value, _i, _len, _results;
var property, value, _results;
if (options == null) {
options = {};
}
_results = [];
for (value = _i = 0, _len = options.length; _i < _len; value = ++_i) {
property = options[value];
for (property in options) {
value = options[property];
_results.push(Rivets.config[property] = value);
}
return _results;
......
......@@ -18,7 +18,8 @@ class Rivets.Binding
# Conditionally also does the inverse and listens to the element for changes
# to propogate back to the context object.
bind: =>
@set() and @adapter.subscribe @context, @keypath, (value) => @set value
@set() if Rivets.config.preloadData
@adapter.subscribe @context, @keypath, (value) => @set value
if @type in bidirectionals
@el.addEventListener 'change', (el) =>
......@@ -79,7 +80,7 @@ Rivets.config =
# binding routines and bind contexts to DOM elements.
rivets =
configure: (options={}) ->
for property, value in options
for property, value of options
Rivets.config[property] = value
register: (routine, routineFunction) ->
......