Skip to content

Commit

Permalink
Merge pull request #103 from AliMD/feat/signal
Browse files Browse the repository at this point in the history
Fix signal update state issue
  • Loading branch information
alimd authored Mar 13, 2022
2 parents 6ad2651 + d50ec38 commit e930d71
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ol>
<li><a href="./logger/">Logger</a></li>
<li><a href="./signal/">Signal</a></li>
<li><a href="./router/">Router</a></li>
</ol>
</body>
</html>
4 changes: 2 additions & 2 deletions demo/logger/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<title>@alwatr/logger</title>
<script type="module" src="./index.js"></script>
</head>

<body>
<h3>Check the console</h3>
<script src="./index.js" type="module"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions demo/router/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@alwatr/router</title>
<script type="module" src="./index.js"></script>
</head>

<body>
<h3>Check the console</h3>
<ol>
<ul><a href="/home">Home</a></ul>
<ul><a href="/about">About</a></ul>
<ul><a href="/products">Products</a></ul>
<ul><a href="/product/1">Product 1</a></ul>
<ul><a href="/contact">Contact</a></ul>
</ol>

<textarea id="output" cols="50" rows="10"></textarea>
</body>
</html>
3 changes: 3 additions & 0 deletions demo/router/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {initialRouter} from '@alwatr/router';

initialRouter();
5 changes: 2 additions & 3 deletions demo/signal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<title>@alwatr/signal</title>
<script type="module" src="./index.js"></script>
</head>

<body>
<h3>Check the console</h3>
<button id="requestButton">Request Signal</button>
<button id="requestButton2">3x Request Signal</button>
<script src="./index.js" type="module"></script>

</body>
</html>
4 changes: 2 additions & 2 deletions package/router/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export function updateBrowserHistory(options: RequestRouteParam): void {
options.hash ??= '';

if (
window.location.pathname === options.pathname ||
window.location.search === options.search ||
window.location.pathname === options.pathname &&
window.location.search === options.search &&
window.location.hash === options.hash
) {
return;
Expand Down

0 comments on commit e930d71

Please sign in to comment.