MCPcopy
hub / github.com/marktext/marktext / add

Method add

packages/desktop/src/main/app/windowManager.ts:121–140  ·  view source on GitHub ↗

* Add the given window to the window list.

(window: BaseWindow)

Source from the content-addressed store, hash-verified

119 * Add the given window to the window list.
120 */
121 add(window: BaseWindow): void {
122 const windowId = window.id as number
123 this._windows.set(windowId, window)
124
125 if (!this._appMenu.has(windowId)) {
126 this._appMenu.addDefaultMenu(windowId)
127 }
128
129 if (this.windowCount === 1) {
130 this.setActiveWindow(windowId)
131 }
132
133 window.on('window-focus', () => {
134 this.setActiveWindow(windowId)
135 })
136 window.on('window-closed', () => {
137 this.remove(windowId)
138 this._watcher.unwatchByWindowId(windowId)
139 })
140 }
141
142 /**
143 * Return the application window by id.

Callers 15

getContainerFunction · 0.45
createDomNodeFunction · 0.45
initLoadLanguageFunction · 0.45
travelFunction · 0.45
renderMermaidMethod · 0.45
renderDiagramMethod · 0.45
renderHtmlMethod · 0.45
loadImageAsyncFunction · 0.45
runLoadFunction · 0.45
listenMethod · 0.45
mouseOverMethod · 0.45

Calls 6

setActiveWindowMethod · 0.95
removeMethod · 0.95
unwatchByWindowIdMethod · 0.80
hasMethod · 0.65
addDefaultMenuMethod · 0.65
onMethod · 0.65

Tested by 1

runLoadFunction · 0.36