@fruit-ui/router 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/router.js +3 -2
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fruit-ui/router",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A basic router component for FRUIT",
|
|
5
5
|
"main": "src/router.js",
|
|
6
6
|
"homepage": "https://asantagata.github.io/fruit-ui/?page=router-index",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"build": "terser .\\src\\router.js -o .\\dist\\router.js"
|
|
9
|
+
"build": "terser .\\src\\router.js -o .\\dist\\router.js --mangle --toplevel"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
12
|
"fruit",
|
package/src/router.js
CHANGED
|
@@ -157,10 +157,11 @@ function broadcastPageChange(page) {
|
|
|
157
157
|
* @param {string} hash - the hash.
|
|
158
158
|
*/
|
|
159
159
|
function navigateHash(hash) {
|
|
160
|
-
|
|
160
|
+
hash = hash.slice(hash.indexOf('#') + 1);
|
|
161
161
|
const url = new URL(window.location.href);
|
|
162
162
|
url.hash = hash;
|
|
163
|
-
|
|
163
|
+
if (hash !== getHash())
|
|
164
|
+
window.history.pushState({}, '', url);
|
|
164
165
|
broadcastHashChange(hash);
|
|
165
166
|
}
|
|
166
167
|
|