ifthen: support if/then/else/finally branch logic in asynchronous Javascript callbacks