main.js 726 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const Appliaction = require('ee-core').Appliaction;
  2. class Main extends Appliaction {
  3. constructor() {
  4. super();
  5. }
  6. /**
  7. * core app have been loaded
  8. */
  9. async ready () {
  10. // do some things
  11. }
  12. /**
  13. * main window have been loaded
  14. */
  15. async windowReady () {
  16. // do some things
  17. }
  18. startEggCluster (options) {
  19. return new Promise((resolve, reject) => {
  20. this.coreLogger.info('[ee-core:EeApp] [startEggCluster] op', options);
  21. const startCluster = require('egg-cluster').startCluster;
  22. startCluster(options, function(){
  23. resolve('success');
  24. });
  25. });
  26. }
  27. /**
  28. * before app close
  29. */
  30. async beforeClose () {
  31. // do some things
  32. }
  33. }
  34. new Main();