MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / setupWindowEvents

Method setupWindowEvents

src/main/api/renderer/window.ts:70–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 }
69
70 private setupWindowEvents(): void {
71 let moveTimeout: NodeJS.Timeout | null = null
72 this.mainWindow?.on('move', () => {
73 if (moveTimeout) clearTimeout(moveTimeout)
74 moveTimeout = setTimeout(() => {
75 if (this.mainWindow) {
76 const [x, y] = this.mainWindow.getPosition()
77 const displayId = windowManager.getCurrentDisplayId()
78 if (displayId !== null) {
79 windowManager.saveWindowPosition(displayId, x, y)
80 }
81 }
82 }, 500)
83 })
84 }
85
86 private hideWindow(isRestorePreWindow: boolean = true): void {
87 windowManager.hideWindow(isRestorePreWindow)

Callers 1

initMethod · 0.95

Calls 3

onMethod · 0.80
getCurrentDisplayIdMethod · 0.80
saveWindowPositionMethod · 0.80

Tested by

no test coverage detected