-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Hi @robtweed
Please consider the following lines:
Lines 95 to 102 in cbf87ac
var options = { | |
nextCallback: route.afterRouter ? true : false | |
}; | |
args = args.concat([qx.router(options)]); | |
// add array with custom middleware to add after qx.router is called (if present) | |
if (route.afterRouter && Array.isArray(route.afterRouter)) args = args.concat(route.afterRouter); |
Some notes:
- I'm not sure that
beforeRouter
/afterRouter
must be validated to be an array because concat works fine if passed argument can be added to existing array ->[1, 2].concat(3) => [1, 2, 3]
- Another note is that, if we keep the current structure and declare
beforeRouter
/afterRouter
as NOT an array,nextCallback
can be set incorrectly (it will betrue
) butafterRouter
won't be added
My proposal here is to allow developers to pass afterRouter
as function of array of functions. In this case we do not need to validate beforeRouter
/afterRouter
for Array.isArray
Metadata
Metadata
Assignees
Labels
No labels