From a1c02449914cc0fb86b553302317ea36f88b40a6 Mon Sep 17 00:00:00 2001 From: Bemi Faison Date: Thu, 20 Feb 2014 06:53:29 -0800 Subject: [PATCH] Passing nav arguments to destination callbacks with `_next` tag --- src/salt.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/salt.js b/src/salt.js index 6a85766..11a3e7c 100644 --- a/src/salt.js +++ b/src/salt.js @@ -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)); } }