Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jQuery Equivalent of Prototype Function.bind

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a jQuery way of doing this Prototype bind?




Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a closure



Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that the purpose of Prototype is to make JavaScript as OO as possible, while jQuery uses JavaScript as itself. As such, Prototype defined .bind() to allow people to not have to really learn how JavaScript works (and thus avoid closures).

While that may have some appeal to some folks, I think it quickly becomes very limiting.
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Eric. closure is cool.
Thanks for the book Ajax In Action too. I have both editions. Any new version?
Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bruce Jin wrote:Thanks for the book Ajax In Action too. I have both editions. Any new version?

Ajax in Action only has a single edition. At one time, Manning planned for a 2nd edition, but there are no current plans for a second.
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks bear.
I messed up Ajax in Practice with Ajax in Action 2. Thanks for been the author!
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No plans on Ajax In Action 2nd ed. we talked about it, but choose not too after long discussions.

I am working on two separate projects now. TOP SECRET.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic