dijon icon indicating copy to clipboard operation
dijon copied to clipboard

added mapCommand, unmapCommand APIs

Open jusopi opened this issue 10 years ago • 2 comments

I thought this would be a good contribution to the API in that it adds functionality much like RobotLeg's command, event bus paradigm.

jusopi avatar May 07 '14 20:05 jusopi

Thanks for the PR, but to be honest I'm not entirely sure whether this is useful... Personally I just map command functions as handlers and do not see the benefit of making them constructable, but YMMV. Do you know of any added benefits to making "classes" with execute functions instead of using plain functions?

creynders avatar May 11 '14 13:05 creynders

I think the encapsulation of the execute, result and error handlers within a "class" or module is beneficial. Otherwise you're having to have awareness of those handlers elsewhere.

Of course this is a moot point if you are just nesting anonymous functions, something I generally try to avoid. On May 11, 2014 9:52 AM, "creynders" [email protected] wrote:

Thanks for the PR, but to be honest I'm not entirely sure whether this is useful... Personally I just map command functions as handlers and do not see the benefit of making them constructable, but YMMV. Do you know of any added benefits to making "classes" with execute functions instead of using plain functions?

— Reply to this email directly or view it on GitHubhttps://github.com/creynders/dijon/pull/4#issuecomment-42771071 .

jusopi avatar May 12 '14 02:05 jusopi