Skip to content

Introduction

Some desktop application features need to be loaded when the software starts; whereas controller layer code is only executed when the frontend sends a request.

Example

javascript
/*************************************************
 ** preload is a preloaded module, this file will be loaded at program startup **
 *************************************************/

import { logger } from 'ee-core/log';
import { trayService } from '../service/os/tray';
import { securityService } from '../service/os/security';
import { autoUpdaterService } from '../service/os/auto_updater';
import { crossService } from '../service/cross';
import { sqlitedbService } from '../service/database/sqlitedb';

export function preload(): void {
  // Example feature modules, can be selectively used and modified
  logger.info('[preload] load 5');
  trayService.create();
  securityService.create();
  autoUpdaterService.create();

  // go server
  crossService.createGoServer();

  // init sqlite db
  sqlitedbService.init();
}