dc4abbc4 by Michael Richards

s/interface/adapter (interface is a reserved keyword in coffeescript 1.3.1).

1 parent b1b0aa9a
// Generated by CoffeeScript 1.3.1
(function() {
window.rivets = (function() {
var attr, bindableAttributes, bindings, getInputValue, registerBinding, setAttribute, _fn, _i, _len;
registerBinding = function(el, interface, type, context, keypath) {
registerBinding = function(el, adapter, type, context, keypath) {
var inputValue;
bindings[type](el, interface.read(context, keypath));
interface.subscribe(context, keypath, function(value) {
bindings[type](el, adapter.read(context, keypath));
adapter.subscribe(context, keypath, function(value) {
return bindings[type](el, value);
});
if (inputValue = getInputValue(el)) {
return interface.publish(context, keypath, inputValue);
return adapter.publish(context, keypath, inputValue);
}
};
setAttribute = function(el, attr, value, mirrored) {
if (mirrored == null) mirrored = false;
if (mirrored == null) {
mirrored = false;
}
if (value) {
return $(el).attr(attr, mirrored ? attr : value);
} else {
......@@ -81,8 +85,10 @@
_fn(attr);
}
return {
bind: function(el, interface, contexts) {
if (contexts == null) contexts = {};
bind: function(el, adapter, contexts) {
if (contexts == null) {
contexts = {};
}
return $(el).add($('*', el)).each(function() {
var nodeMap, target, _j, _ref, _results;
target = this;
......@@ -101,7 +107,7 @@
path = node.value.split('.');
context = path.shift();
keypath = path.join('.');
return registerBinding($(target), interface, type, contexts[context], keypath);
return registerBinding($(target), adapter, type, contexts[context], keypath);
}
}
});
......@@ -110,3 +116,5 @@
}
};
})();
}).call(this);
......
......@@ -4,14 +4,14 @@
# license : MIT
window.rivets = do ->
registerBinding = (el, interface, type, context, keypath) ->
bindings[type] el, interface.read(context, keypath)
registerBinding = (el, adapter, type, context, keypath) ->
bindings[type] el, adapter.read(context, keypath)
interface.subscribe context, keypath, (value) ->
adapter.subscribe context, keypath, (value) ->
bindings[type] el, value
if inputValue = getInputValue el
interface.publish context, keypath, inputValue
adapter.publish context, keypath, inputValue
setAttribute = (el, attr, value, mirrored=false) ->
if value
......@@ -53,7 +53,7 @@ window.rivets = do ->
bindings[attr] = (el, value) ->
setAttribute el, attr, value
bind: (el, interface, contexts={}) ->
bind: (el, adapter, contexts={}) ->
$(el).add($('*', el)).each ->
target = this
nodeMap = target.attributes
......@@ -69,4 +69,4 @@ window.rivets = do ->
path = node.value.split '.'
context = path.shift()
keypath = path.join '.'
registerBinding $(target), interface, type, contexts[context], keypath
registerBinding $(target), adapter, type, contexts[context], keypath
......