Instead of booleans or enums why not have different methods for each value of the bool/enum, e.g.:
openAsync(...),
open(...)
if (someCondition) {
showFoo();
} else {
hideFoo();
}
Instead of: setFooVisible(someCondition);
The point being, creating lots of different methods for each variant reduces one's ability to use other abstraction tools, like variables, to control parameters. (someCondition? showFoo : hideFoo)();
You can also pass in arguments if they both accept the same parameters, eg. (someCondition? show : hide)(foo, duration); (someCondition ? foo.show : foo.hide)();
except the language does not auto-bind so you have to write (someCondition ? foo.show : foo.hide).call(foo);
or maybe (someCondition ? foo.show.bind(foo) : foo.hide.bind(foo))(); foo[someCondition? 'show' : 'hide']();
Although looking up functions using raw strings is less than elegant. I'd be tempted to abstract the pattern using a function, but at that point I'd be doing functional programming anyway and wouldn't be using methods ;)A bit odd given jQuery often provides both options e.g. show[0]/hide[1] and toggle(bool)[2].
[0] http://api.jquery.com/show/