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

Method updateState

renderer/renderJS/main_ui_lib.js:257–294  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

255
256 // MARK: update state
257 updateState() {
258 window.main_IPC.updateState().then((status) => {
259 MA.byId('debug_danger_bubble').clsShow(status.dangerDebug)
260 MA.byId('prefcanvas_error').clsShow(status.prefDanger)
261 MA.byId('topBar-preferences').clsOrGate(status.prefDanger, 'pref-danger', null)
262 MA.byId('topBar-update').clsShow(status.updateReady)
263 this.flag.folderDirty = status.foldersDirty
264 this.flag.gameRunning = status.gameRunning
265 this.flag.launchEnable = status.gameRunningEnabled
266 MA.byId('dirty_folders').clsShow(this.flag.folderDirty)
267 MA.byId('gameRunningBubble')
268 .clsShow(this.flag.launchEnable)
269 .clsOrGate(this.flag.gameRunning, 'text-success', 'text-danger')
270
271
272 if ( Object.keys(status.botStatus.response).length === 0 ) { return }
273
274 if ( !status.keepLoaderModal && MA.byId('loadOverlay').checkVisibility() ) {
275 this.loader.hide()
276 }
277
278 for ( const [CKey, IDs] of Object.entries(status.botStatus.requestMap) ) {
279 const thisBotDiv = this.collections?.[CKey]?.nodeBot ?? null
280
281 if ( thisBotDiv === null ) { continue }
282 thisBotDiv.innerHTML = ''
283
284 for ( const thisID of IDs ) {
285 thisBotDiv.appendChild(this.#botEntry(
286 thisID,
287 status.botStatus.response[thisID],
288 status.botStatus.response[thisID].status === 'Good',
289 status.botStatus.l10nMap
290 ))
291 }
292 }
293 })
294 }
295
296 #botEntry(id, response, isGood, l10n) {
297 const thisStatus = !isGood ? 'broken' : response.online ? 'online' : 'offline'

Callers 1

constructorMethod · 0.95

Calls 3

#botEntryMethod · 0.95
keysMethod · 0.80
hideMethod · 0.45

Tested by

no test coverage detected