app.js 871 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * 全局定义
  3. * @param app
  4. */
  5. 'use strict';
  6. class AppBootHook {
  7. constructor(app) {
  8. this.app = app;
  9. }
  10. configWillLoad() {
  11. // Ready to call configDidLoad,
  12. // Config, plugin files are referred,
  13. // this is the last chance to modify the config.
  14. }
  15. configDidLoad() {
  16. // Config, plugin files have been loaded.
  17. }
  18. async didLoad() {
  19. // All files have loaded, start plugin here.
  20. }
  21. async willReady() {
  22. // All plugins have started, can do some thing before app ready
  23. }
  24. async didReady() {
  25. // Worker is ready, can do some things
  26. // don't need to block the app boot.
  27. }
  28. async serverDidReady() {
  29. // Server is listening.
  30. // const storageFile = './storage';
  31. // utils.chmodPath(storageFile, '777');
  32. }
  33. async beforeClose() {
  34. // Do some thing before app close.
  35. }
  36. }
  37. module.exports = AppBootHook;