@jack-henry/web-component-router
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -49,3 +49,3 @@ import RouteTreeNode from './lib/route-tree-node.js'; | ||
currentElement.classList.add(className); | ||
return super.routeEnter(currentNode, nextNodeIfExists, routeId, context, next); | ||
return super.routeEnter(currentNode, nextNodeIfExists, routeId, context); | ||
} | ||
@@ -52,0 +52,0 @@ |
{ | ||
"name": "@jack-henry/web-component-router", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Web Components Router", | ||
@@ -5,0 +5,0 @@ "main": "router.js", |
@@ -77,3 +77,5 @@ /** | ||
/** @type {!Set<!function()>} */ | ||
this.routeChangeStartCallbacks_ = new Set(); | ||
/** @type {!Set<!function(!Error=)>} */ | ||
this.routeChangeCompleteCallbacks_ = new Set(); | ||
@@ -207,3 +209,3 @@ } | ||
/** @param {!Function} callback */ | ||
/** @param {!function()} callback */ | ||
addRouteChangeStartCallback(callback) { | ||
@@ -213,3 +215,3 @@ this.routeChangeStartCallbacks_.add(callback); | ||
/** @param {!Function} callback */ | ||
/** @param {!function()} callback */ | ||
removeRouteChangeStartCallback(callback) { | ||
@@ -219,3 +221,3 @@ this.routeChangeStartCallbacks_.delete(callback); | ||
/** @param {!Function} callback */ | ||
/** @param {!function(!Error=)} callback */ | ||
addRouteChangeCompleteCallback(callback) { | ||
@@ -225,3 +227,3 @@ this.routeChangeCompleteCallbacks_.add(callback); | ||
/** @param {!Function} callback */ | ||
/** @param {!function(!Error=)} callback */ | ||
removeRouteChangeCompleteCallback(callback) { | ||
@@ -367,6 +369,12 @@ this.routeChangeCompleteCallbacks_.delete(callback); | ||
this.currentNodeId_ = routeTreeNode.getKey(); | ||
await routeTreeNode.activate(this.prevNodeId, context); | ||
/** @type {!Error|undefined} */ | ||
let routeError; | ||
try { | ||
await routeTreeNode.activate(this.prevNodeId, context); | ||
} catch (err) { | ||
routeError = err; | ||
} | ||
next(); | ||
this.nextStateWasPopped = false; | ||
this.routeChangeCompleteCallbacks_.forEach((cb) => cb()); | ||
this.routeChangeCompleteCallbacks_.forEach((cb) => cb(routeError)); | ||
} | ||
@@ -373,0 +381,0 @@ |
@@ -16,5 +16,5 @@ import RouteTreeNode from './lib/route-tree-node.js'; | ||
* @param {!Context} context | ||
* @param {function(boolean=)} next | ||
* @return {!Promise<boolean|undefined>} | ||
*/ | ||
routeEnter(currentNode, nextNodeIfExists, routeId, context, next) { } | ||
async routeEnter(currentNode, nextNodeIfExists, routeId, context) { } | ||
@@ -29,5 +29,5 @@ /** | ||
* @param {!Context} context | ||
* @param {function(boolean=)} next | ||
* @return {!Promise<undefined>} | ||
*/ | ||
routeExit(currentNode, nextNode, routeId, context, next) { } | ||
async routeExit(currentNode, nextNode, routeId, context) { } | ||
}; | ||
@@ -55,3 +55,3 @@ | ||
* @param {!Context} context | ||
* @return {!Promise<undefined>} | ||
* @return {!Promise<boolean|undefined>} | ||
*/ | ||
@@ -58,0 +58,0 @@ async routeEnter(currentNode, nextNodeIfExists, routeId, context) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42318
891