557742db by Michael Richards

Update the handler API and simplify the on-* binder's routine to use the eventHandler factory.

1 parent a5a6ad5e
...@@ -368,10 +368,8 @@ Rivets.binders = ...@@ -368,10 +368,8 @@ Rivets.binders =
368 Rivets.Util.unbindEvent el, @args[0], @handler if @handler 368 Rivets.Util.unbindEvent el, @args[0], @handler if @handler
369 369
370 routine: (el, value) -> 370 routine: (el, value) ->
371 binding = this
372 Rivets.Util.unbindEvent el, @args[0], @handler if @handler 371 Rivets.Util.unbindEvent el, @args[0], @handler if @handler
373 @handler = (ev) -> binding.view.config.handler value, @, ev, binding 372 Rivets.Util.bindEvent el, @args[0], @handler = @eventHandler value
374 Rivets.Util.bindEvent el, @args[0], @handler
375 373
376 "each-*": 374 "each-*":
377 block: true 375 block: true
...@@ -451,8 +449,8 @@ Rivets.binders = ...@@ -451,8 +449,8 @@ Rivets.binders =
451 # overridden globally or local to a `Rivets.View` instance. 449 # overridden globally or local to a `Rivets.View` instance.
452 Rivets.config = 450 Rivets.config =
453 preloadData: true 451 preloadData: true
454 handler: (fn, context, ev, binding) -> 452 handler: (context, ev, binding) ->
455 fn.call context, ev, binding.view.models 453 @call context, ev, binding.view.models
456 454
457 # Rivets.formatters 455 # Rivets.formatters
458 # ----------------- 456 # -----------------
......