gmac / backbone.epoxy

Declarative data binding and computed models for Backbone
http://epoxyjs.org
MIT License
614 stars 89 forks source link

how to handle keyCode (and event) on "events:['keyup']" #16

Closed pechorin closed 11 years ago

pechorin commented 11 years ago

Hello! this is my binding:

  bindings: {
    "input.alias" : "value:protected_email,events:['keyup']"
  }

the problem is set function in computeds fire each keyup, and what is okay, but i need to handle only 'enter'-key keyup event (keyCode == 13). What i should do? Where i can capture event variable?

gmac commented 11 years ago

Hmm... this isn't formally supported, although it probably should be. I'll mark this as an enhancement and look into adding the event object as a param of binding handlers. Will follow up shortly...

gmac commented 11 years ago

This has been updated and committed to master. Once you swap in the new Epoxy script (v0.12.7), your get-handler functions should receive a third param – which is the original event object that triggered the getter to run. See the updated website documentation.

pechorin commented 11 years ago

Great!