GM_xmlhttpRequest 封装
As of
This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://updategf.qytechs.cn/scripts/565272/1749373/GM_request.js
需要在主脚本引入 GM_xmlhttpRequest
// @grant GM_xmlhttpRequest
使用:
GM_request({
url: location.href,
method: "get",
// ...其他 GM_xmlhttpRequest 参数
maxRetries: 5, // 重试次数
// 重试回调
onretry(details) {
console.warn(
`请求失败,正在重试:${details.currentRetry}/${details.maxRetries}`,
);
},
}).then((res) => {
console.log(res.response);
});