A more powerful Next.js router events API.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore Lots of updates. Mar 23, 2018
.npmrc Version 1.0.0. Oct 18, 2017
.prettierignore End file with newline. Jun 27, 2018
.travis.yml Bump min Node.js version to v6. Jun 27, 2018
changelog.md Version 2.1.0. Jun 27, 2018
index.js Fix up eslint-config-env. Jun 27, 2018
readme.md Readme tweaks. Jun 27, 2018



Build status npm version

A more powerful Next.js router events API. The standard API can only handle one listener per router event (see zeit/next.js#2033).


To install next-router-events from npm run:

npm install next-router-events


To use router events:

import routerEvents from 'next-router-events'

const logUrl = url => console.log(url)
const alertUrl = url => alert(url)

routerEvents.on('routeChangeComplete', logUrl)
routerEvents.once('routeChangeComplete', alertUrl)
routerEvents.off('routeChangeComplete', logUrl)

See next router events and tiny-emitter instance methods.