From 270a4883ca15684ee729926b7940f9338525362e Mon Sep 17 00:00:00 2001 From: Iain J McCallum Date: Thu, 25 Aug 2016 12:08:16 -0400 Subject: [PATCH 1/2] Adding some info about event callbacks --- docs/docs/reference/_binders/on-[event].md | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/docs/reference/_binders/on-[event].md b/docs/docs/reference/_binders/on-[event].md index 76de98ab6..df55c292a 100644 --- a/docs/docs/reference/_binders/on-[event].md +++ b/docs/docs/reference/_binders/on-[event].md @@ -5,3 +5,40 @@ Binds an event listener on the element using the event specified in `[event]` an ```html ``` + +*The callback function is passed 1: an event object and 2: the bound context which will also include named refrences to nested bindings.* + +```html + +``` + +```javascript +view = { + a: [ { b:[ { "..." } ] } ], + clicked: function(e, bound){ + console.log(bound); + } +} + +rivets.bind(el, {view: view}); +``` + +``` +//console output: +{ + view: {...}, + b: {...}, + a: {...}, + index:n +} +``` + +*Also note that the arguments passed to the event callback can be [reconfigured](/docs/guide/#usage-configuring) through the `handler` property.* \ No newline at end of file From f219fb6ea4a5c80da19a694df5ed53c26743291d Mon Sep 17 00:00:00 2001 From: Iain J McCallum Date: Thu, 1 Sep 2016 09:17:09 -0400 Subject: [PATCH 2/2] Fixing typo! --- docs/docs/reference/_binders/on-[event].md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/reference/_binders/on-[event].md b/docs/docs/reference/_binders/on-[event].md index df55c292a..191f0d1e6 100644 --- a/docs/docs/reference/_binders/on-[event].md +++ b/docs/docs/reference/_binders/on-[event].md @@ -6,7 +6,7 @@ Binds an event listener on the element using the event specified in `[event]` an ``` -*The callback function is passed 1: an event object and 2: the bound context which will also include named refrences to nested bindings.* +*The callback function is passed 1: an event object and 2: the bound context which will also include named references to nested bindings.* ```html