From 21e0cbc229f3da0f2b10716be06752465fee7dfc Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 7 Dec 2009 00:26:00 -0500 Subject: [PATCH] simplified the bindAll example --- index.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/index.html b/index.html index a881ae043..eacb7016e 100644 --- a/index.html +++ b/index.html @@ -646,11 +646,7 @@ var buttonView = { onClick : function(){ alert('clicked: ' + this.label); }, onHover : function(){ console.log('hovering: ' + this.label); } }; - -// In this case, the following two lines have the same effect. -_.bindAll(buttonView, 'onClick', 'onHover'); -_(buttonView).bindAll(); - +_.bindAll(buttonView); jQuery('#underscore_button').bind('click', buttonView.onClick); => When the button is clicked, this.label will have the correct value...