2.7.0 • Published 7 years ago
alauda v2.7.0
alauda
tools for webapps
Install
npm install --save alauda
Usage
History
import { on, start, navigate } from 'alauda/history';
start(); // start listening for history changes
// listen for history changes
on('redirect', function(url) {
console.log(url);
});
// example with ga
on('changed', function(url) {
_gaq.push(['_trackPageview', url]);
})
navigate('/'); // indicate to the browser to change url
navigate('/', true); // indicate to the browser to change url by replacing the current one
Web app
Use history to navigate and redirect
import { init, redirect } from 'alauda/web-app';
init((url) => {
console.log(url);
});
redirect('/'); // manually ask for a redirect of url