t-comm
Version:
专业、稳定、纯粹的工具库
32 lines (29 loc) • 616 B
JavaScript
import { isBrowserInPixui } from './validator.mjs';
var isHooked = false;
function proxyCookie() {
var str = '';
Object.defineProperty(document, 'cookie', {
get: function get() {
return str;
},
set: function set(value) {
str = value;
}
});
}
function hook() {
// @ts-ignore
if (typeof H5ElementTag !== 'undefined') {
// @ts-ignore
H5ElementTag.prototype.pathname = '';
}
document.cookie = '';
proxyCookie();
}
function networkHookInPixui() {
if (isBrowserInPixui()) return;
if (isHooked) return;
isHooked = true;
hook();
}
export { networkHookInPixui };