index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*************************************************
  2. ** preload为预加载模块,该文件将会在程序启动时加载 **
  3. *************************************************/
  4. const ChildJob = require('ee-core/module/jobs/child');
  5. const Ps = require('ee-core/module/ps');
  6. const Log = require('ee-core/module/log');
  7. const test = require('./test');
  8. /**
  9. * 预加载模块入口
  10. * @param {Object} app - 全局app对象
  11. */
  12. module.exports = async (app) => {
  13. //已实现的功能模块,可选择性使用和修改
  14. const trayAddon = app.addon.tray;
  15. const securityAddon = app.addon.security;
  16. const awakenAddon = app.addon.awaken;
  17. const autoUpdaterAddon = app.addon.autoUpdater;
  18. trayAddon.create();
  19. securityAddon.create();
  20. awakenAddon.create();
  21. autoUpdaterAddon.create();
  22. Log.info("[main] process type: ", Ps.processType());
  23. Log.info("[main] process cwd: ", process.cwd());
  24. test();
  25. let myJob = new ChildJob();
  26. myJob.exec('./jobs/example.js', {name: 'gsx1'});
  27. setTimeout(function(){
  28. myJob.exec('./jobs/example.js', {name: 'gsx2'});
  29. }, 5000)
  30. // let opt2 = {
  31. // dev: true,
  32. // type: 'child', // renderer
  33. // path: './jobs/example.js',
  34. // winOptions: {
  35. // show: true
  36. // },
  37. // childOptions: {}
  38. // }
  39. // let myJob2 = new OriginJob();
  40. // myJob2.create('exampleJob2', opt2);
  41. }