I have an object which is a list of filters corresponding to a select list. When the user selects from a drop-down I want update the object using this getter/setter. I'm also using an event listener. I thought the argument would be automatically passed into the handler.
var formFilters = {
audience: 'All',
get audienceFilter() {
return this.audience;
},
set audienceFilter(input) {
$('select').on('change', this.audienceFilter);
}
};
Then to see what's going on:
$('select').on('change', function(e){
console.log(formFilters.audience);
});