1
0
Fork 0
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:
Arunoda Susiripala 2017-03-13 06:36:50 +05:30 committed by Guillermo Rauch
parent 02e697cb0d
commit bb7c8f87c6

View file

@ -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 {