0.1.7 • Published 2 years ago

miniapp-history v0.1.7

Weekly downloads
184
License
-
Repository
github
Last release
2 years ago

MiniApp History

Install

$ npm install miniapp-history --save

Usage

Example1: normal case

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);

Example2: history.listen

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();

API

Support

  • push(path)
  • replace(path)
  • back(delta)
  • canGo()
  • listen(callback)

UnSupport

  • go(callback)
  • goForward()
0.1.6-beta.1

2 years ago

0.1.7-1

2 years ago

0.1.7-0

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

3 years ago

0.1.5-0

3 years ago

0.1.5-1

3 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.1.0-1

4 years ago

0.1.0-0

4 years ago