得先确认Electron是否能够支持扩展,这个我没有接触过
然后脚本猫的话,可以在这里,添加安装脚本的代码,然后打包
setTimeout(async () => {
const { script } = await prepareScriptByCode(
`// ==UserScript==
// @name New Userscript(预安装)
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description try to take over the world!
// @author You
// @match https://bbs.tampermonkey.net.cn/thread-5410-1-1.html
// ==/UserScript==
(function() {
'use strict';
// Your code here...
})();`,
"",
"e127e14b-2a96-4523-839f-7bd594e7b75d",
true
);
console.log(
(IoC.instance(ScriptManager) as ScriptManager).event.upsertHandler(
script
)
);
}, 3000);