编辑代码

var _wr = function (type) {
    var origin = history[type]

    return function () {
        var rv = origin.apply(this, arguments);
        var e = new Event(type)
        e.arguments = arguments
        window.dispatchEvent(e)
        return rv;
    }
}
history.pushState = _wr('pushState');
history.replaceState = _wr('replaceState')