umi electron 插件的需求记录
- 优化打包方式,不再进行package.json检查,直接生成新的package.json
- 支持mpa模式
- 主进程的 ts 类型问题
- 支持通过 tmpFile 写入基础的 runtime(还是通过统一的 runtime 支持)
- entry
- env
- version
- 【周边生态】pro-layout type=”electron”
Runtime
import { } from ‘umi/electron-runtime/main’;
alias : {
electron-runtime : “@electron-lab/runtime”
}
痛点:
- 进程通讯管理
- 多窗口问题
- 单窗口管理
- 窗口事件
const win = createWindow('main',{
entry ?: '#main' // default "#main"
});
const subWin = createWindow('pref',{
// closeFollow : win,
cloaseFollow : getWindowInstance('win'),
})
// 类型怎么处理?
getWinodwInstance('main').on('close',(e)=>{
e.preventDefault();
})
const OPEN_NEW_WINDOW = 'open/new_window';
import { createEvents } from 'electron-runtime/main'
const events = createEvents({
on : {
[OPEN_NEW_WINDOW] : (windowInstance,...args)=>{
},
close : async(windowInstance,e)=>{
await windowInstance.webContents.invoke('')
}
},
handle : {
},
});
const newEvents = inheritEvents(events,{
})
const newnewEvents = combineEvents()
events.connectTo([win]);
// in renderer
import { createEvents } from 'electron-runtime/renderer';
const events = createEvents({
on : {},
handle : {
'shouldClose' : async()=>{
}
},
})
ipcRenderer.send(OPEN_NEW_WINDOW,'123');
版本记录
版本 | 日期 | 更新说明 |
---|---|---|
0.1.0-0 | ||
0.1.0-1 | ||
0.1.0-2 | ||
0.1.0-3 | 2021.01.04 | (以往的更新暂不记录) |