Miniapp implementation of history.
bash
$ npm install miniapp-history --save
`Usage
$3
`js
import { createMiniAppHistory } from 'miniapp-history';const routes = [
{
'path': '/',
'source': 'pages/Home/index'
},
{
'path': '/page1',
'source': 'pages/Page1/index',
},
{
'path': '/page2',
'source': 'pages/Page2/index'
}
];
const history = createMiniAppHistory(routes);
`$3
`js
const unlisten = history.listen(({ location, action }) => {
console.log(
The current URL is ${location.pathname}${location.search}${location.hash}
);
console.log(The last navigation action was ${action});
});// ...
// Clean up
unlisten();
``