diff options
author | Andinus <andinus@nand.sh> | 2021-10-09 20:09:00 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2021-10-09 20:09:00 +0530 |
commit | fc6b96e1f8e4f9f1f43ead24de9a0361b0e71bbb (patch) | |
tree | 7b49948d415d8dd940c04c0c480be926f314c7a1 /src | |
parent | cd3d4a7c6b5338c843451ee97dabe2d60281681c (diff) | |
download | dorado-fc6b96e1f8e4f9f1f43ead24de9a0361b0e71bbb.tar.gz |
Update dispatch mechanism
Diffstat (limited to 'src')
-rw-r--r-- | src/Navbar.svelte | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Navbar.svelte b/src/Navbar.svelte index 97d8348..5b70e53 100644 --- a/src/Navbar.svelte +++ b/src/Navbar.svelte @@ -7,19 +7,21 @@ const dispatch = createEventDispatcher(); - const pageHome = () => {dispatch('message', { page: Home });} - const pageDDA = () => {dispatch('message', { page: DDA });} - const pageBresenham = () => {dispatch('message', { page: Bresenham });} + const changePage = (p) => dispatch('message', { page: p }); </script> <nav class="ddmenu"> - <button on:click={pageHome}>Home</button> + <button on:click={() => changePage(Home)}>Home</button> <div class="ddgroup"> Line Drawing Algorithms <div class="ddsub"> - <button on:click={pageDDA}>Digital differential analyzer</button> - <button on:click={pageBresenham}>Bresenham</button> + <button on:click={() => changePage(DDA)}> + Digital differential analyzer + </button> + <button on:click={() => changePage(Bresenham)}> + Bresenham + </button> </div> </div> </nav> |