mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Use a private Router event API for the ondemand-pinger. (#1397)
This commit is contained in:
parent
02e697cb0d
commit
bb7c8f87c6
|
@ -3,11 +3,9 @@
|
||||||
import Router from '../lib/router'
|
import Router from '../lib/router'
|
||||||
import fetch from 'unfetch'
|
import fetch from 'unfetch'
|
||||||
|
|
||||||
const originalRouteChangeComplete = Router.onRouteChangeComplete
|
Router.ready(() => {
|
||||||
Router.onRouteChangeComplete = (...args) => {
|
Router.router.on('routeChangeComplete', ping)
|
||||||
if (originalRouteChangeComplete) originalRouteChangeComplete(...args)
|
})
|
||||||
ping()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function ping () {
|
async function ping () {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue