Skip to content

Commit

Permalink
Passing nav arguments to destination callbacks with _next tag
Browse files Browse the repository at this point in the history
  • Loading branch information
bemson committed Feb 20, 2014
1 parent 800741e commit a1c0244
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/salt.js
Expand Up @@ -1694,6 +1694,8 @@
isOnTraversal = !phase,
isRedirect = fnc === redirectFlag,
delayed = isOnTraversal && node.delay,
nexted = 0,
targetsLn,
redIndex,
redConfig,
nxtIndex
Expand Down Expand Up @@ -1727,6 +1729,7 @@
nxtIndex = node.nxt;

if (~nxtIndex) {
nexted = 1;
if (node.nxtc) {
// queue (and clear) next immediate target
proxy.get.apply(proxy, [nxtIndex].concat(pkgArgs));
Expand All @@ -1748,8 +1751,9 @@
pkg.calls[pkg.calls.length] = node.index + '.' + phase;

if (!isRedirect) {
// include arguments for the "on" function
pkg.result = fnc.apply(proxy, (pkg.targets.length ? staticUnusedArray : pkgArgs));
targetsLn = pkg.targets.length;
// include arguments for the destination state's "on" function
pkg.result = fnc.apply(proxy, ((!targetsLn || (targetsLn === 1 && nexted)) ? pkgArgs : staticUnusedArray));
}

}
Expand Down

0 comments on commit a1c0244

Please sign in to comment.