import { ipcRenderer } from "electron" ; import React from "react" ; import ReactDOM from "react-dom" ; import { IPCMessageNames } from "../../ipc/IPCMessageNames" ; import { SettingsForm } from "./SettingsForm" ; class SettingsApp extends React . Component < any , any > { public render ( ) { return < SettingsForm />; } } const topLevelNode = document . getElementById ( 'react-dom-bind' ) as HTMLElement ; ReactDOM . render ( React . createElement ( SettingsApp , null ) , topLevelNode ) ; ipcRenderer . on ( IPCMessageNames . RequestShutdown , ( ) => { const obs = new MutationObserver ( ( ) => { ipcRenderer . sendSync ( IPCMessageNames . AllowShutdown ) ; } ) ; obs . observe ( topLevelNode , { childList : true , subtree : true } ) ; ReactDOM . unmountComponentAtNode ( topLevelNode ) ; } ) ;