erictgrubaugh
03/06/2019, 9:10 PMdefine([], function () {
const functionRouter = {
"doAThing": oneFunction,
"doAnotherThing": anotherFunction,
"thatOtherThing": yetAnotherFn
}
function oneFunction(context) { ... }
function anotherFunction(context) { ... }
function yetAnotherFn(context) { ... }
return {
post: function (context) {
try {
(functionRouter[context.action])(context);
} catch (e) {
onError(context);
}
}
});
untested of course, and I never write my entry point functions within the return statement, but that s/b pretty close to what you're trying