hftf / coords

2 stars 1 forks source link

Removed currying from State.setState. #47

Closed MattiasBuelens closed 10 years ago

MattiasBuelens commented 10 years ago

Turns out we don't even need the currying for the map parameter, we can just pass the state.checked and state.indeterminate arrays as argument. :stuck_out_tongue: I just removed the curry helper altogether.

Made rotateState(s) accept the DOM element as parameter. This puts it in line with the setState signature and makes it easier to work with.

hftf commented 10 years ago

Ahhh that’s too bad we removed the _State.setState.state functions, I was going to split up the setState method like this :stuck_out_tongue_closed_eyes:

setStates: function(state, els) {
    return Array.prototype.map.call(els, this.setState[state]);
},
MattiasBuelens commented 10 years ago

I don't really like adding properties to a function, i.e. setState.checked. Although I agree that perhaps the handling of arrays can be moved outside of setState and let setState only deal with a single ID or element as input.

hftf commented 10 years ago

How about d10aa37? Would be nicer without that silly for loop :stuck_out_tongue:

MattiasBuelens commented 10 years ago

Sure, that works too.