diff --git a/CHANGELOG.md b/CHANGELOG.md index d4c3431c..6730025a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 8.6.4 + +Refactoring the leave hook implementation. The leave hook check now run a bit earlier and once per navigating. So far it was running for each of the matched routes. Also the hook now may accept an array of matches. Not only a single Match object. + ## 8.6.2, 8.6.3 Fixing a bug with matching a wildcard. diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 948320c5..0e694226 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -495,7 +495,7 @@ type RouteHooks = { * The `before` hook receives two arguments. The first one is a function that needs to be called with either no arguments or `false`. The no-argument version means "move forward". `false` stops the resolving and your handler will not be called. * `after` is called after your handler -* `leave` is called when you are about to leave out of the route. Similarly to the `before` hook accepts a function as first argument and a [Match](#match) object as second. If the function is called with `false` Navigo will stop resolving the new matched route meaning "we cant' go out of the current route". +* `leave` is called when you are about to leave out of the route. Similarly to the `before` hook accepts a function as first argument and a [Match](#match) object (or an array of [Match](#match) objects) as second. If the function is called with `false` Navigo will stop resolving the new matched route meaning "we cant' go out of the current route". * `already` is called when this is the current route and it matches again ### Defining hooks for specific route @@ -693,7 +693,7 @@ type Route = { type RouteHooks = { before?: (done: Function, match: Match) => void; after?: (match: Match) => void; - leave?: (done: Function, match: Match) => void; + leave?: (done: Function, match: Match | Match[]) => void; already?: (match: Match) => void; }; ``` diff --git a/package.json b/package.json index e7272a4a..43f653cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "navigo", - "version": "8.6.3", + "version": "8.6.4", "description": "A simple vanilla JavaScript router", "main": "lib/navigo.js", "browser": "lib/navigo.min.js",