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”
}

痛点:

  1. 进程通讯管理
    1. 多窗口问题
    2. 单窗口管理
  2. 窗口事件
  1. const win = createWindow('main',{
  2. entry ?: '#main' // default "#main"
  3. });
  4. const subWin = createWindow('pref',{
  5. // closeFollow : win,
  6. cloaseFollow : getWindowInstance('win'),
  7. })
  8. // 类型怎么处理?
  9. getWinodwInstance('main').on('close',(e)=>{
  10. e.preventDefault();
  11. })
  12. const OPEN_NEW_WINDOW = 'open/new_window';
  13. import { createEvents } from 'electron-runtime/main'
  14. const events = createEvents({
  15. on : {
  16. [OPEN_NEW_WINDOW] : (windowInstance,...args)=>{
  17. },
  18. close : async(windowInstance,e)=>{
  19. await windowInstance.webContents.invoke('')
  20. }
  21. },
  22. handle : {
  23. },
  24. });
  25. const newEvents = inheritEvents(events,{
  26. })
  27. const newnewEvents = combineEvents()
  28. events.connectTo([win]);
  29. // in renderer
  30. import { createEvents } from 'electron-runtime/renderer';
  31. const events = createEvents({
  32. on : {},
  33. handle : {
  34. 'shouldClose' : async()=>{
  35. }
  36. },
  37. })
  38. 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 (以往的更新暂不记录)