修复 1.2.5 structuredClone错误 by cyfung1031 · Pull Request #1192 · scriptscat/scriptcat
一个兼容TM的示例,很极端的用法,说实话不是很想咬文嚼字,内部实现本来就不一样,硬要一致会多一些莫名其妙的代码,不用完全一致
// ==UserScript== // @name New Userscript REDV-1 // @namespace https://docs.scriptcat.org/ // @version 0.1.0 // @description try to take over the world! // @author You // @match https://*/* // @icon https://www.google.com/s2/favicons?sz=64&domain=example.com // @early-start // @run-at document-start // @grant GM_setValue // @grant GM_getValue // @grant GM_setValues // @grant GM_getValues // ==/UserScript== console.log(GM_getValue("circular"), GM_getValues(["circular"])); // undefined {} GM_setValues({ "circular": "123" }); console.log(GM_getValue("circular"), GM_getValues(["circular"])); // 123 {"circular":123} GM_setValues({ "circular": window }); console.log(GM_getValue("circular"), GM_getValues(["circular"])); // undefined {circular: undefined} GM_setValue("circular", window) console.log(GM_getValue("circular"), GM_getValues(["circular"])); // undefined {circular: undefined}