fix(stage-tamagotchi): max listener exceeded warning, set to 100 before improving eventa
This commit is contained in:
@@ -7,7 +7,7 @@ import { platform } from 'node:process'
|
||||
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
||||
import { Format, LogLevel, setGlobalFormat, setGlobalLogLevel, useLogg } from '@guiiai/logg'
|
||||
import { createLoggLogger, injecta } from '@proj-airi/injecta'
|
||||
import { app, Menu, nativeImage, Tray } from 'electron'
|
||||
import { app, ipcMain, Menu, nativeImage, Tray } from 'electron'
|
||||
import { noop, once } from 'es-toolkit'
|
||||
import { isLinux, isMacOS } from 'std-env'
|
||||
|
||||
@@ -23,6 +23,11 @@ import { setupMainWindow } from './windows/main'
|
||||
import { setupSettingsWindowReusableFunc } from './windows/settings'
|
||||
import { toggleWindowShow } from './windows/shared/window'
|
||||
|
||||
// TODO: once we refactored eventa to support window-namespaced contexts,
|
||||
// we can remove the setMaxListeners call below since eventa will be able to dispatch and
|
||||
// manage events within eventa's context system.
|
||||
ipcMain.setMaxListeners(100)
|
||||
|
||||
setElectronMainDirname(__dirname)
|
||||
setGlobalFormat(Format.Pretty)
|
||||
setGlobalLogLevel(LogLevel.Log)
|
||||
|
||||
@@ -217,7 +217,7 @@ export function setupCaptionWindowManager(params: { mainWindow: BrowserWindow })
|
||||
lastAppliedTy = ty
|
||||
// Animate towards target at throttled cadence for visible easing
|
||||
settleTo(tx, ty)
|
||||
}, 1000 / 30)
|
||||
}, 1000 / 60)
|
||||
|
||||
const settleDebounced = debounce(() => {
|
||||
settleTo(lastTx, lastTy)
|
||||
@@ -246,6 +246,11 @@ export function setupCaptionWindowManager(params: { mainWindow: BrowserWindow })
|
||||
let eventaContext: ReturnType<typeof createContext>['context'] | undefined
|
||||
|
||||
const reusable = createReusableWindow(async () => {
|
||||
// TODO: once we refactored eventa to support window-namespaced contexts,
|
||||
// we can remove the setMaxListeners call below since eventa will be able to dispatch and
|
||||
// manage events within eventa's context system.
|
||||
ipcMain.setMaxListeners(100)
|
||||
|
||||
const window = createCaptionWindow()
|
||||
const { context } = createContext(ipcMain, window)
|
||||
eventaContext = context
|
||||
@@ -274,6 +279,7 @@ export function setupCaptionWindowManager(params: { mainWindow: BrowserWindow })
|
||||
}
|
||||
updateConfig(config)
|
||||
}
|
||||
|
||||
window.on('resize', persistBounds)
|
||||
window.on('move', persistBounds)
|
||||
|
||||
|
||||
@@ -9,6 +9,11 @@ import { createScreenService, createWindowService } from '../../../services/elec
|
||||
import { toggleWindowShow } from '../../shared'
|
||||
|
||||
export function setupMainWindowElectronInvokes(params: { window: BrowserWindow, settingsWindow: () => Promise<BrowserWindow> }) {
|
||||
// TODO: once we refactored eventa to support window-namespaced contexts,
|
||||
// we can remove the setMaxListeners call below since eventa will be able to dispatch and
|
||||
// manage events within eventa's context system.
|
||||
ipcMain.setMaxListeners(100)
|
||||
|
||||
const { context } = createContext(ipcMain, params.window)
|
||||
|
||||
createScreenService({ context, window: params.window })
|
||||
|
||||
@@ -8,6 +8,11 @@ import { electronOpenSettingsDevtools } from '../../../../shared/eventa'
|
||||
import { createScreenService, createWindowService } from '../../../services/electron'
|
||||
|
||||
export async function setupSettingsWindowInvokes(params: { settingsWindow: BrowserWindow }) {
|
||||
// TODO: once we refactored eventa to support window-namespaced contexts,
|
||||
// we can remove the setMaxListeners call below since eventa will be able to dispatch and
|
||||
// manage events within eventa's context system.
|
||||
ipcMain.setMaxListeners(0)
|
||||
|
||||
const { context } = createContext(ipcMain, params.settingsWindow)
|
||||
|
||||
createScreenService({ context, window: params.settingsWindow })
|
||||
|
||||
Reference in New Issue
Block a user