manages browsing session history jsr.io/@mary/history
typescript jsr
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: update readme example

Mary 53a8607c 4d217d5d

+10
+10
README.md
··· 3 3 manages browsing session history 4 4 5 5 ```ts 6 + import { createBrowserHistory } from '@mary/history'; 7 + import { createHistoryStack } from '@mary/history/stack'; 8 + 6 9 const history = createBrowserHistory(); 10 + const stack = createHistoryStack(history); 7 11 8 12 history.listen(({ action, location }) => { 9 13 console.log(action, location.pathname); ··· 15 19 history.update({ theme: 'dark' }); 16 20 // action: "update" 17 21 22 + console.log(stack.entries.map((e) => e?.pathname)); 23 + // e.g. ["/", "/dashboard"] 24 + 18 25 history.back(); 26 + // action: "traverse" 27 + 28 + console.log(stack.canGoForward); // true 19 29 ```