MCPcopy Create free account
hub / github.com/FSGModding/FSG_Mod_Assistant / createNamedMulti

Method createNamedMulti

lib/modAssist_window_lib.js:804–842  ·  view source on GitHub ↗
(winName, windowArgs, extraCallback = null)

Source from the content-addressed store, hash-verified

802
803 // MARK: cNamedMulti
804 createNamedMulti(winName, windowArgs, extraCallback = null) {
805 const subWinDef = this.winDefs[winName]
806 const thisWinName = subWinDef.winName
807
808 const thisWindow = this.createSubWindow(thisWinName, subWinDef.subWindowArgs)
809
810 this.multiWin.push(thisWindow)
811
812 thisWindow.webContents.on('did-finish-load', async () => {
813 subWinDef.callback(windowArgs)
814 if ( typeof extraCallback === 'function' ) { extraCallback() }
815
816 if ( this.#debug && this.#dev.has(thisWinName) ) {
817 thisWindow.webContents.openDevTools()
818 }
819 })
820
821 const HTMLFileFull = path.join(this.#path.render, subWinDef.HTMLFile)
822
823 if ( typeof windowArgs.queryString === 'undefined' ) {
824 thisWindow.loadFile(HTMLFileFull)
825 } else {
826 thisWindow.loadURL(`file://${HTMLFileFull}?${windowArgs.queryString}`)
827 }
828
829 thisWindow.on('closed', () => {
830 if ( typeof subWinDef.extraCloseFunc === 'function' ) {
831 subWinDef.extraCloseFunc()
832 }
833 this.destroyAndFocusMulti()
834 })
835
836 if ( subWinDef.handleURLinWin ) {
837 thisWindow.webContents.setWindowOpenHandler(({ url }) => {
838 shell.openExternal(url)
839 return { action : 'deny' }
840 })
841 }
842 }
843
844 /**
845 * Create a named window

Callers 1

openDetailWindowFunction · 0.80

Calls 4

createSubWindowMethod · 0.80
hasMethod · 0.80
loadFileMethod · 0.80
destroyAndFocusMultiMethod · 0.80

Tested by

no test coverage detected