main.js 821 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const { Application } = require('ee-core');
  2. const EE = require('ee-core/ee');
  3. class Main extends Application {
  4. constructor() {
  5. super();
  6. // this === eeApp;
  7. }
  8. /**
  9. * core app have been loaded
  10. */
  11. async ready () {
  12. // do some things
  13. }
  14. /**
  15. * electron app ready
  16. */
  17. async electronAppReady () {
  18. // do some things
  19. }
  20. /**
  21. * main window have been loaded
  22. */
  23. async windowReady () {
  24. // do some things
  25. // 延迟加载,无白屏
  26. const winOpt = this.config.windowsOption;
  27. if (winOpt.show == false) {
  28. const win = this.electron.mainWindow;
  29. win.once('ready-to-show', () => {
  30. win.show();
  31. })
  32. }
  33. }
  34. /**
  35. * before app close
  36. */
  37. async beforeClose () {
  38. // do some things
  39. }
  40. }
  41. // Instantiate an app object
  42. EE.app = new Main();