baconjs / bacon.jquery

MIT License
74 stars 23 forks source link

TextFieldValue: Add 'onchange' event to the event stream. #43

Closed fujimotos closed 9 years ago

fujimotos commented 9 years ago

What's the problem?

As of the moment , we can't use jQuery.ui.datepicker and Bacon.$.textFieldValue on the same input element as follows:

var dateinput = $("#date")
dateinput.datepicker()
Bacon.$.textFieldValue(dateinput).onValue(function(){
     // something
});

... simply because textFieldValue does not listen to 'change' events on the text input, and fails to notice as the datepicker modifies the value of the input element.

The proposal

The problem above can be easily fixed by adding 'change' event to this line:

events = element.asEventStream("keyup input")

The fix above also will increase the interoperability with libraries other than jQuery.ui.

raimohanska commented 9 years ago

0.4.12 is out. thanks!