UNPKG

vuepress-playground

Version:
11 lines (10 loc) 352 B
export default function hashChangeHandler (fn) { const pushState = window.history.pushState window.history.pushState = function (state) { if (typeof window.history.onpushstate === 'function') { window.history.onpushstate({ state: state }) } setTimeout(_ => { fn() }, 0) return pushState.apply(window.history, arguments) } }