Skip to content

Commit 826d164

Browse files
committed
🐛 修复debug值问题 #163
1 parent 021e6db commit 826d164

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/pages/options/main.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class DebugPermissionVerify implements IPermissionVerify {
5050
return Promise.resolve(true);
5151
}
5252
}
53+
5354
const gmapi = new GMApi(messageSandbox, new DebugPermissionVerify());
5455
gmapi.start();
5556
IoC.registerInstance(GMApi, gmapi);
@@ -62,6 +63,16 @@ tryConnect(message, (ok: boolean) => {
6263
}
6364
});
6465

66+
// 处理沙盒加载消息
67+
messageSandbox.setHandler("sandboxOnload", () => {
68+
return Promise.resolve(true);
69+
});
70+
71+
// 转发value变更消息给沙盒
72+
message.setHandler("valueUpdate", (action, value) => {
73+
messageSandbox.send("valueUpdate", value);
74+
});
75+
6576
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
6677
<div>
6778
<MainLayout className="!flex-row" pageName="options">

src/pages/options/routes/script/ScriptEditor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ function ScriptEditor() {
585585
droplist={
586586
<Menu
587587
style={{
588-
backgroundColor: "var(--color-secondary)",
589588
padding: "0",
590589
margin: "0",
591590
borderRadius: "0",

src/runtime/content/runtime.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export default class RuntimeController {
2828
async debugScript(script: Script) {
2929
// 清理脚本缓存,避免GMApi中的缓存影响
3030
Cache.getInstance().del(CacheKey.script(script.id));
31+
Cache.getInstance().del(
32+
CacheKey.scriptValue(script.id, script.metadata.storagename)
33+
);
3134
// 构建脚本代码
3235
return this.runtime.startBackgroundScript(script);
3336
}

0 commit comments

Comments
 (0)