new (class PageContext { constructor(clientKey) { this.client = window[Symbol.for(clientKey)]; this.bindEvents(); } bindEvents() { const self = this; history.pushState = (f => function pushState() { const ret = f.apply(this, arguments); self.onUrlChange(); return ret; })(history.pushState); let firstReplaceEvent = true; history.replaceState = (f => function replaceState(params) { var ret = f.apply(this, arguments); if (!firstReplaceEvent) { self.onUrlChange(); } firstReplaceEvent = false; return ret; })(history.replaceState); window.addEventListener(‘hashchange’, function () { self.onUrlChange(); }); } onUrlChange() { this.client.emitToBg(‘URLS_SAFE_CHECK__CONTENT_URL_REWRITED’); } })(‘MARIO_POST_CLIENT_eppiocemhmnlbhjplcgkofciiegomcon’)
Score
[Total: 0 Moyenne: 0]