🐛 Fix(custom): remove listener before unmount

This commit is contained in:
Kuingsmile
2024-05-25 21:06:27 +08:00
parent c102ac5158
commit 8b21e8407c
5 changed files with 8 additions and 9 deletions

View File

@@ -180,8 +180,8 @@ class LifeCycle {
shortKeyHandler.init()
})
server.startup()
startFileServer()
webServer.start()
startFileServer()
if (process.env.NODE_ENV !== 'development') {
handleStartUpFiles(process.argv, process.cwd())
}
@@ -229,7 +229,7 @@ class LifeCycle {
}
#onRunning () {
app.on('second-instance', (event, commandLine, workingDirectory) => {
app.on('second-instance', (_, commandLine, workingDirectory) => {
logger.info('detect second instance')
const result = handleStartUpFiles(commandLine, workingDirectory)
if (!result) {

View File

@@ -11,8 +11,7 @@ class ManageDB {
this.#db = new JSONStore(this.#ctx.configPath)
let initParams: IStringKeyMap = {
picBed: {},
settings: {},
currentPicBed: 'placeholder'
settings: {}
}
for (let key in initParams) {
if (!this.#db.has(key)) {

View File

@@ -31,7 +31,7 @@ export class ManageApi extends EventEmitter implements ManageApiType {
constructor (currentPicBed: string = '') {
super()
this.currentPicBed = currentPicBed || (this.getConfig('currentPicBed') ?? 'placeholder')
this.currentPicBed = currentPicBed || 'placeholder'
this.configPath = managePathChecker()
this.initConfigPath()
this.logger = new ManageLogger(this)