Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runRoute function (dead code) #254

Open
aplicacionamedida opened this issue May 27, 2016 · 0 comments
Open

runRoute function (dead code) #254

aplicacionamedida opened this issue May 27, 2016 · 0 comments

Comments

@aplicacionamedida
Copy link

I observed some dead code in the funciton runRoute():

          if (typeof(route.callback) === "function") {
            route.callback = [route.callback];
          }
          if (route.callback && route.callback.length) {
            i = -1;
            nextRoute = function() {
              i++;
              if (route.callback[i]) {
                returned = route.callback[i].apply(context,callback_args);
              } else if (app._onComplete && typeof(app._onComplete === "function")) {
                app._onComplete(context);
              }
            };
            callback_args.push(nextRoute);
            nextRoute();
          }

Variable "i" has no meaning, because a chain of callback is not well implemented.

For this reason, I think that this code should be deleted also:

        if (typeof(route.callback) === "function") {
            route.callback = [route.callback];
          }

Callback should be always a function. Never an array.

For this reason this code , also has to be changed:

    if (route.callback[i]) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant