Permalink
Browse files

Passing nav arguments to destination callbacks with `_next` tag

  • Loading branch information...
1 parent 800741e commit a1c02449914cc0fb86b553302317ea36f88b40a6 @bemson committed Feb 20, 2014
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/salt.js
View
@@ -1694,6 +1694,8 @@
isOnTraversal = !phase,
isRedirect = fnc === redirectFlag,
delayed = isOnTraversal && node.delay,
+ nexted = 0,
+ targetsLn,
redIndex,
redConfig,
nxtIndex
@@ -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));
@@ -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));
}
}

0 comments on commit a1c0244

Please sign in to comment.