index.js 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const { Application } = require('ee-core');
  2. const HttpServer = require('./server/http');
  3. class Index extends Application {
  4. constructor() {
  5. super();
  6. // this === eeApp;
  7. this.httpServer = new HttpServer();
  8. }
  9. /**
  10. * core app have been loaded
  11. */
  12. async ready () {
  13. // do some things
  14. }
  15. /**
  16. * electron app ready
  17. */
  18. async electronAppReady () {
  19. // do some things
  20. }
  21. /**
  22. * main window have been loaded
  23. */
  24. async windowReady () {
  25. // do some things
  26. // 延迟加载,无白屏
  27. const winOpt = this.config.windowsOption;
  28. if (winOpt.show == false) {
  29. const win = this.electron.mainWindow;
  30. win.once('ready-to-show', () => {
  31. win.show();
  32. win.focus();
  33. })
  34. }
  35. // 启动HTTP服务
  36. // this.httpServer.start();
  37. }
  38. /**
  39. * before app close
  40. */
  41. async beforeClose () {
  42. // do some things
  43. // 关闭HTTP服务器
  44. // this.httpServer.stop();
  45. }
  46. }
  47. Index.toString = () => '[class Index]';
  48. module.exports = Index;