Skip to content

GM_setValue的實現跟TM版不同? #493

@cyfung1031

Description

@cyfung1031

public GM_setValue(key: string, value: any) {
// 对object的value进行一次转化
if (typeof value === "object") {
value = JSON.parse(JSON.stringify(value));
}
if (value === undefined) {
delete this.scriptRes.value[key];
return this.sendMessage("GM_setValue", [key]);
} else {
this.scriptRes.value[key] = value;
return this.sendMessage("GM_setValue", [key, value]);
}
}

undefined 當作刪鍵的話
listValues的結果會不一樣吧

(還有GM_setValue 不應回傳任何東西)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions