sushao 我的话是通过 Typora
生成 html
再通过 utools.createBrowserWindow
这个 api 版本的话是根据保存当前版本,每次第一次启动读取 plugin.json 版本比较
preload.js
const path = require('path');
window.pluginInfo = JSON.parse(fs.readFileSync(path.join(__dirname, 'plugin.json')));
// 创建更新窗口
window.createUpdateWindow = () => {
const optional = {
width: 800,
height: 600,
title: '更新说明',
transparent: false,
frame: true,
alwaysOnTop: true
}
const win = utools.createBrowserWindow("./README.html", optional);
};
在 onPluginReady
中
const pluginInfo = window.pluginInfo;
// 更新数据处理
if (read('version') !== pluginInfo.version) {
update('version', pluginInfo.version);
window.createUpdateWindow();
}