-
Notifications
You must be signed in to change notification settings - Fork 314
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
你好,
同样的脚本, 在0.9.1上正常执行
但是0.10.x上不会执行then的内容, 但是看网络请求是正常的, 不知道是不是responseType:'arraybuffer'出的问题
// ==UserScript==
// @name New Userscript
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description try to take over the world!
// @author You
// @require https://cdn.jsdelivr.net/npm/scriptcat-lib@1.1.1/dist/gm.js
// @definition https://cdn.jsdelivr.net/npm/scriptcat-lib@1.1.1/src/types/gm.d.ts
// @grant GM_xmlhttpRequest
// @grant GM_log
// @grant GM_setValue
// @grant GM_getValue
// @background
// @connect https://s1.ax1x.com
// ==/UserScript==
let done;
gm.ajax({method:'get',url:'https://s1.ax1x.com/2022/05/26/XEW4te.png', responseType:'arraybuffer'})
.then(resp=>{
// 0.10.x, 这下面的代码不会执行
let count = GM_getValue('count',0);
GM_log(count++);
GM_setValue('count',count);
GM_log(JSON.stringify(resp).substr(0,1000));
console.log(resp);
done();
}).catch(e=>{
let count = GM_getValue('count',0);
GM_log(count++);
GM_setValue('count',count);
done();
});
return new Promise((resolve, reject) => {
// Your code here...
done = resolve;
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working