77351bb8 by Michael Richards

Expose a register function to register new custom binding routines.

1 parent 2cad87fc
......@@ -76,6 +76,9 @@
bidirectionals = ['value', 'checked', 'unchecked', 'selected', 'unselected'];
rivets = {
register: function(routine, routineFunction) {
return bindings[routine] = routineFunction;
},
bind: function(el, adapter, contexts) {
var attribute, context, keypath, node, path, type, _i, _len, _ref, _results;
if (contexts == null) {
......
......@@ -65,8 +65,12 @@ bindings =
# to propogate those changes back to the model object.
bidirectionals = ['value', 'checked', 'unchecked', 'selected', 'unselected']
# The rivets module. Exposes a single `bind` function.
# The rivets module exposes `register` and `bind` functions to register new
# binding routines and bind contexts to DOM elements.
rivets =
register: (routine, routineFunction) ->
bindings[routine] = routineFunction
bind: (el, adapter, contexts = {}) ->
for node in el.getElementsByTagName '*'
for attribute in node.attributes
......