import { EVT } from './EVT' ; class Support { constructor ( ) { this . supportListenHistory ( ) ; this . listenPageSwitch ( ) ; } private supportListenHistory ( ) { const element = document . createElement ( 'script' ) ; element . setAttribute ( 'type' , 'text/javascript' ) ; element . innerHTML = `
    let _wr = function (type) {
      let orig = history[type];
      return function () {
        let rv = orig.apply(this, arguments);
        let e = new Event(type);
        e.arguments = arguments;
        window.dispatchEvent(e);
        return rv;
      };
    };
    history.pushState = _wr('pushState');
    history.replaceState = _wr('replaceState');
    ` ; document . head . appendChild ( element ) ; } private listenPageSwitch ( ) { ; [ 'pushState' , 'popstate' , 'replaceState' ] . forEach ( ( item ) => { window . addEventListener ( item , ( ) => { EVT . fire ( EVT . events . pageSwitch ) ; } ) ; } ) ; } } new Support ( ) ; export { } ;