Closed dillongreen closed 8 years ago
Yes, please :) The following might work, didn't try it though.
ViewModel.addBinding("change", {
on: "cut paste keyup input change focus blur"
});
Edit: manuel:viewmode
says
It will trigger when the following bindings are affected: value, checked, text, and focused.
I just added all the events dalgard:viewmodel
uses for value
, checked
and focused
bindings, but I'm not sure why manuel added the focused binding. Just because something is focused doesn't mean it's changed. So you might try without focus blur
Edit 2: keyup
is no guarantee for a changed value as well, the user might have pressed arrow keys or so. So I guess that cut paste input change
should do it.
Sure, I don't mind including any useful binding that is not tied specifically to a project.
The fastest and easiest way to get it included in the package is to use it for a couple of days and then post the code in an issue – if everything works as expected, we're good. Bindings don't have any capacity to ruin the library as a whole.
I'm closing this issue and am awaiting the submission of a tested binding – please leave a comment, though, if you feel insecure about posting code, and we'll figure it out together.
@zimt28: I'm happy to see that you've read the docs and grasped the binding syntax well enough to omit the get
function :+1:
I'd like to see, out of curiosity, a use case of change
that can't be achieved with the value
binding. Not to imply that it doesn't exist – it just seemed to me before that you'd always need to put the value somewhere.
What do you think about adding the
change
binding, same as manual's viewmodel package has it http://viewmodel.meteor.com/#changeBk ?