surprise
2024-03-05 1ce1b525e7470ebaaeb0d5cd1e59bd905c1a7114
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);
        }
    }
});