北京经济技术开发区经开区虚拟城市项目-【前端】-Web
lixuliang
2023-11-15 c658f316d2f464e510d10f1081c52848c3aefeb2
1
2
3
4
5
6
7
8
9
10
11
12
self.addEventListener('message', function (e) {
    let data = e.data;
    let xhr = new XMLHttpRequest();
    xhr.open(data.type, data.url, data.async === undefined ? true : data.async);
    xhr.send(data.data || {});
    xhr.onreadystatechange = function () {
        if (this.readyState === 4 && this.status === 200) {
            data.xmlText = this.responseText
            postMessage(data);
        }
    }
});