Electron IpcRendererEvent TypeScript Examples (2023)

The following examples show how to useelectron#IpcRendererEvent.You can vote for the ones you like or reject the ones you don't like and go to the original project or source file by following the links above each example. You can check the usage of the related API in the sidebar.

Example 1

Source file:RendererToMainStateForwarder.tsFrom kliveide licensed by MIT6wishesElectron IpcRendererEvent TypeScript Examples (1)Electron IpcRendererEvent TypeScript Examples (2)
/** * Initializes the listener that processes responses */ constructor(publicread-only source ID: MessageSource) {super(); renderizadoripc?.on(to be.responseChannel,(_ev: IpcRendererEvent, response: Response Message) => to be.processResponse(response) ); }

Example #2

Source file:OneToMainMessenger.tsFrom kliveide licensed by MIT6wishesElectron IpcRendererEvent TypeScript Examples (3)Electron IpcRendererEvent TypeScript Examples (4)
/** * Initializes the listener that processes responses */ constructor() {super(); renderizadoripc?.on(to be.responseChannel,(_ev: IpcRendererEvent, response: Response Message) => to be.processResponse(response) ); }

Example #3

Source file:emu-message-processor.tsFrom kliveide licensed by MIT6wishesElectron IpcRendererEvent TypeScript Examples (5)Electron IpcRendererEvent TypeScript Examples (6)
// --- Configure message processingrenderizadoripc.on("MainToEmuRequest",asynchronous(_ev: IpcRendererEvent, mensagem: RequestMessage) => {constantanswer =waitprocessEmulatorMessages(mmessage); response.correlationId = message.correlationId; rendereripc.send("Main Response to Emu", answer); });

Example #4

Source file:ide-message-processor.tsFrom kliveide licensed by MIT6wishesElectron IpcRendererEvent TypeScript Examples (7)Electron IpcRendererEvent TypeScript Examples (8)
// --- Configure message processingrenderizadoripc.on("IdeToEmuEmuSolicitud",asynchronous(_ev: IpcRendererEvent, mensagem: RequestMessage) => {constantanswer =waitprocessIdeMessages(mmessage); response.correlationId = message.correlationId; rendereripc.send("IdeToEmuEmuRespuesta", answer); });

Example #5

Source file:IdeToEmuMessenger.tsFrom kliveide licensed by MIT6wishesElectron IpcRendererEvent TypeScript Examples (9)Electron IpcRendererEvent TypeScript Examples (10)
/** * Initializes the listener that processes responses */ constructor() {super(); renderizadoripc?.on(to be.responseChannel,(_ev: IpcRendererEvent, response: Response Message) => to be.processResponse(response) ); }

(Video) ipcMain to ipcRenderer Data Communication + How to modify HTML from ipcMain - Electron JS Tutorial

Example #6

Source file:ide-message-processor.tsFrom kliveide licensed by MIT6wishesElectron IpcRendererEvent TypeScript Examples (11)Electron IpcRendererEvent TypeScript Examples (12)
// --- Configure message processingrenderizadoripc.on("MainToIdeRequest",asynchronous(_ev: IpcRendererEvent, mensagem: RequestMessage) => {constantanswer =waitprocessIdeMessages(mmessage); response.correlationId = message.correlationId; rendereripc.send("MainToIdeResponse", answer); });

Example #7

Source file:FeedbackModal.tsxFrom SeeQR under MIT license6wishesElectron IpcRendererEvent TypeScript Examples (13)Electron IpcRendererEvent TypeScript Examples (14)
FeedbackModal =()=>{constant[isOpen, setOpen] = useState(FALSE);constant[mensagem, setMessage] = useState('');constant[severidad, establecerSeveridad] = useState<FeedbackSeverity>('information'); useEffect(()=>{constantreceive feedback =(evt: IpcRendererEvent, comments: Comments) =>{constantValid types: FeedbackSeverity[] = ['success','error','information','Notice'];// Ignore 'success' comments. con(validtypes.includes(feedback.type)) { setSeverity(feedback.type); setMessage(feedback.message?.toString() ??'ERROR: Operation failed'); setOpen(TRUE); } }; renderizadoripc.on('opinion', receive feedback);return ()=>{ ipcRenderer.removeListener('opinion', receive feedback); }; });constantclose identifier =()=>setOpen(FALSE);return( <Snackbar open={isOpen} onClose={handleClose} autoHideDuration={readingTime(message)} anclaOrigin={{ vertical: 'bottom', horizontal: 'right' }} // desactivar la ocultación sin clickAway ClickAwayListenerProps={{ onClickAway : () => {} }} > <Alert onClose={handleClose} gravity={severity}> {mensaje} </Alert> </Snackbar> );}

Example #8

Source file:preloadBindings.tsMaking TidGi-Desktop with Mozilla Public License 2.06wishesElectron IpcRendererEvent TypeScript Examples (15)Electron IpcRendererEvent TypeScript Examples (16)
preloadBindings =function(ipc-renderer: ipc-renderer):{ onLanguageChange:(call back:(language: { lng:rope}) =>unknown) => empty; aoReceber:(channel: I18NChannels, callback:(readWriteFileArgs: IReadWriteFileRequest) => empty) => empty; to send:(canal: I18NChannels, readWriteFileArgs: IReadWriteFileRequest) => Promise<empty>;} {return{ to send:asynchronous(canal: I18NChannels, readWriteFileArgs: IReadWriteFileRequest):Promise<empty> => {constantvalidChannels = [I18NChannels.readFileRequest, I18NChannels.writeFileRequest];con(valid channels.includes(channel)) {waitipcRenderer.invoke(channel, readWriteFileArgs); } }, upon receiving:(channel: I18NChannels, callback:(readWriteFileArgs: IReadWriteFileRequest) => empty) =>{constantvalidChannels = [I18NChannels.readFileResponse, I18NChannels.writeFileResponse];con(valid channels.includes(channel)) {// Deliberately excludes the event since it includes "sender"ipcRenderer.on(canal,(_event: IpcRendererEvent, arguments_: IReadWriteFileRequest) =>callback(argumentos_)); } }, onLanguageChange:(call back:(language: { lng:rope}) =>unknown) =>{// Deliberately excludes the event since it includes "sender"ipcRenderer.on(I18NChannels.changeLanguageRequest,(_event: IpcRendererEvent, language: { long:rope}) =>{ callback (idiom); }); }, };}

Example #9

Source file:rendererMenuItemProxy.tsMaking TidGi-Desktop with Mozilla Public License 2.06wishesElectron IpcRendererEvent TypeScript Examples (17)Electron IpcRendererEvent TypeScript Examples (18)
(Video) Electron JS Tutorial: ipcRenderer - All communication methods of explained
/** * Iterate through the object, replace each object's method with a random uuid, and send this object without a callback to the main thread. * Register IPCRenderer.on (uuid for each object method * @returns unregisters the function */export function renderizadorMenuItemProxy(menus: MenuItemConstructorOptions[]): [IpcSafeMenuItem[], () =>empty]{constantoriginalCallbackIdMap: Registro<rope,()=> empty> = {};constantipcCallbackIdMap: Registro<rope,(_event: IpcRendererEvent) => empty> = {};constantcancel registration = ():empty=>{Object.keys(originalCallbackIdMap).forEach((identification) =>{ ipcRenderer.removeListener(id, ipcCallbackIdMap[id]);deleteoriginalCallbackIdMap[id];deleteipcCallbackIdMap[id]; }); };constantnewMenus: IpcSafeMenuItem[] = [];for(constantmenuItem from menus) {con(menuItem.click !==Undefined) {constantid = uuid();// stores the callback in the map and uses id instead. And we ipc.in that identification.originalCallbackIdMap[id] = menuItem.clickas() =>empty;constantipcCallback = (_event: IpcRendererEvent):empty=>{ originalCallbackIdMap[id]?.(); cancelar registro(); }; ipcCallbackIdMap[id] = ipcCallback; ipcRenderer.on(id, ipcCallback); newMenus.push({ ...menuItem, haga clic en: id, }); } }return[new menus, unregister];}

Example #10

Source file:preload.tsFrom kliveide licensed by MIT5wishesElectron IpcRendererEvent TypeScript Examples (19)Electron IpcRendererEvent TypeScript Examples (20)
contextBridge.exposeInMainWorld("ipcRenderer", <IpcRendereApi>{ send:(canal:rope, ...arguments:any[]) =>ipcRenderer.send(channel, ...arguments), to: (channel:rope, listener:(event: IpcRendererEvent, ... arguments:any[]) => empty) => ipcRenderer.on(channel, listener),});

Example #11

Source file:preload.tsFrom WowUp under the GNU General Public License v3.05wishesElectron IpcRendererEvent TypeScript Examples (21)Electron IpcRendererEvent TypeScript Examples (22)
function onRendererEvent(canal:rope, listener:(event: IpcRendererEvent, ... arguments:any[]) => empty){ ipcRenderer.on(channel, listener);}

Example #12

Source file:preload.tsFrom WowUp under the GNU General Public License v3.05wishesElectron IpcRendererEvent TypeScript Examples (23)Electron IpcRendererEvent TypeScript Examples (24)
function onceRendererEvent(canal:rope, listener:(event: IpcRendererEvent, ... arguments:any[]) => empty){ ipcRenderer.once(channel, listener);}

Example #13

Source file:preload.tsFrom WowUp under the GNU General Public License v3.05wishesElectron IpcRendererEvent TypeScript Examples (25)Electron IpcRendererEvent TypeScript Examples (26)
function rendererOn(canal:rope, listener:(event: IpcRendererEvent, ... arguments:any[]) => empty){ ipcRenderer.on(channel, listener);}

Example #14

Source file:electronic.service.tsFrom WowUp under the GNU General Public License v3.05wishesElectron IpcRendererEvent TypeScript Examples (27)Electron IpcRendererEvent TypeScript Examples (28)
publiconRendererEvent(canal: MainChannels, oyente:(event: IpcRendererEvent, ... arguments:any[]) => empty):empty{ventana.wowup?.onRendererEvent(canal, salida); }

Example #15

(Video) 05 - Electron IPC Renderer and how to use it for form submission

Source file:electronic.service.tsFrom WowUp under the GNU General Public License v3.05wishesElectron IpcRendererEvent TypeScript Examples (29)Electron IpcRendererEvent TypeScript Examples (30)
publicon (channel:rope, listener:(event: IpcRendererEvent, ... arguments:any[]) => empty):empty{ventana.wowup.rendererOn(channel, listener); }

Example #16

Source file:CanalMensaje.tsxFrom multi-downloader-nx under MIT license5wishesElectron IpcRendererEvent TypeScript Examples (31)Electron IpcRendererEvent TypeScript Examples (32)
MessageChannelProvider: React.FC =({ children }) =>{constant[store, send] = useStore();constant{ ipc renderer } = (ventana asany).electronas{ipc renderer: IpcRenderer };constantrandom event handler = React.useMemo(()=> nuevoRandom event handler(), []); react.useEffect(()=>{ (asynchronous() => {constantcurrent service =waitrenderizadoripc.invoke('type');con(current service !==Undefined)returnDispatch({type:'service',useful load: current service });con(store.service !== currentService) ipcRenderer.invoke('establish', store.service) })(); }, [store.service, dispatch, ipcRenderer]) React.useEffect(()=>{/* trim is a placeholder */ constantlistener =(_: IpcRendererEvent, initial data: RandomEvent<'finish'>) =>{constanteventName = datainicial.nameasrandom events key;constantdata = initial dataasa strangerasRandom event<kind ofevent name>; randomEventHandler.emit(data.name, data); } rendereripc.on('random event', listener);return ()=>{ ipcRenderer.removeListener('random event', listener); }; }, [processoripc]);constantmessage handler: FrontEndMessanges = {authentication:asynchronous(data) =>waitrenderizadoripc.invoke('authentic', data),verification sheet:asynchronous() =>waitrenderizadoripc.invoke('checkToken'),look for:asynchronous(data) =>waitrenderizadoripc.invoke('look for', data),handleDefault:asynchronous(data) =>waitrenderizadoripc.invoke('standard', data),available DubCodes:asynchronous() =>waitrenderizadoripc.invoke('DisponibleDubCodes'),available subcodes:asynchronous() =>waitrenderizadoripc.invoke('available subcodes'),solve elements:asynchronous(data) =>waitrenderizadoripc.invoke('resolving', data),listepisodes:asynchronous(data) =>waitrenderizadoripc.invoke('listEpisodes', data),random events: random event handler,discharge element:(data) =>renderizadoripc.invoke('download item', data),It is downloading:()=>ipcRenderer.sendSync('It is downloading'),write on clipboard:asynchronous(data) =>waitrenderizadoripc.invoke('write to clipboard', data),open folder:asynchronous(data) =>waitrenderizadoripc.invoke('open folder', data),go out:()=>ipcRenderer.sendSync('changeProvider') }return<messageChannelContext.Provider value={messageHandler}> {filhos} </messageChannelContext.Provider>;}

Example #17

Source file:DbView.tsxFrom SeeQR under MIT license5wishesElectron IpcRendererEvent TypeScript Examples (33)Electron IpcRendererEvent TypeScript Examples (34)
ViewBD =({selectedDb, show, setERView, ERView}: DbViewProps) =>{constant[dbTables, setTables] = useState<TableInfo[]>([]);constant[selectedTable, setSelectedTable] = useState<TableInfo>();constant[databases, setDatabases] = useState<DatabaseInfo[]>([]);constant[open, defineOpen] = useState(FALSE); useEffect(()=>{// Listen to the backend for updates to the list of tables in the current database constanttableFromBackend =(evt: IpcRendererEvent, dbLists: desconocido) =>{con(isDbLists(dbLists)) { setDatabases(dbLists.databaseList); setTables(dbLists.tableList); setSelectedTable(selectedTable || dbLists.tableList[0]); } }; renderizadoripc.on('db lists', tabelasDeBackend); solicitarDbListOnce();// return the cleanup function return ()=>{ ipcRenderer.removeListener('db lists', tabelasDeBackend); }; });constanthandleClickOpen =()=>{ defineAbrir(TRUE); };constantclose identifier =()=>{ defineAbrir(FALSE); };constantdb = databases.find((dbN) =>dbN.db_name === selectedDb);con(!show)return null;return( <> <DatabaseDetails db={db} /> <br /> <TablesTabs // setTables={setTables} tables={dbTables} selectTable={(table: TableInfo) => setSelectedTable(table)} selectedTable={selectedTable} selectedDb={selectedDb} setERView={setERView} /> <br /> <br /> {(selectedTable && !ERView) ? ( <StyledDummyButton variant="contained" color="primary" onClick={handleClickOpen} > Gerar dados fictícios </StyledDummyButton> ) : null} <DummyDataModal open={open} onClose={handleClose} dbName={db?.db_name} tableName={selectedTable?.table_name} /> </> );}

Example #18

Source file:ipc-renderer.tsFrom the MIT licensed electronic playground5wishesElectron IpcRendererEvent TypeScript Examples (35)Electron IpcRendererEvent TypeScript Examples (36)
ipcRendererListener = ( eventName: IPCEventName, callback:(event: IpcRendererEvent, ... arguments:any[]) => empty,):empty=>{ ipcRenderer.on(eventName,(event, ... arguments:any[]) =>{ callback (event, ... arguments) })}

Example #19

Source file:ipc-renderer.tsFrom the MIT licensed electronic playground5wishesElectron IpcRendererEvent TypeScript Examples (37)Electron IpcRendererEvent TypeScript Examples (38)
listenerNewDownloadItem = (callback:(event: IpcRendererEvent, ... arguments:any[]) => empty,):empty=>ipcRendererListener('new download item', call back)

Example #20

Source file:ipc-renderer.tsFrom the MIT licensed electronic playground5wishesElectron IpcRendererEvent TypeScript Examples (39)Electron IpcRendererEvent TypeScript Examples (40)
(Video) Electron js tutorial for beginners #6 IPC Render and Main render | share data
listenerDownloadItemUpdate = (callback:(event: IpcRendererEvent, ... arguments:any[]) => empty,):empty=>ipcRendererListener('download item update', call back)

Example #21

Source file:ipc-renderer.tsFrom the MIT licensed electronic playground5wishesElectron IpcRendererEvent TypeScript Examples (41)Electron IpcRendererEvent TypeScript Examples (42)
listenerDownloadItemDone = (callback:(event: IpcRendererEvent, ... arguments:any[]) => empty,):empty=>ipcRendererListener('downloadItemDone', call back)

Example #22

Source file:window controls.tsxFrom simulator with Apache License 2.04wishesElectron IpcRendererEvent TypeScript Examples (43)Electron IpcRendererEvent TypeScript Examples (44)
WindowControls: React.FC<WindowControlsProps> = ({ disabledMaximize, disabledMinimize, browserWindowId,}) => {constant[esMaximizado, establishEsMaximizado] = useState(FALSE);constantremoteBrowserWindowId = useRef(browserWindowId); usarEfecto(()=>{constantonMaximimizeStateChange = ( _event: IpcRendererEvent,isWindowMaximumized: boleano,targetBrowserWindowId: number ) => {con(targetBrowserWindowId === remoteBrowserWindowId.current) { setIsMaximized(isWindowMaximumized); } }; renderizadoripc.on('electron-react-titlebar/maximize/change', onMaximimizeStateChange );constantactualizarRemoteBrowserWindowId =asynchronous() => { remoteBrowserWindowId.actual = (waitrenderizadoripc.invoke('electron-react-titlebar/inicializar', browserWindowId ))asnumber; };// eslint-disable-next-line promessa/catch-or-returnactualizarRemoteBrowserWindowId().finally(()=> null);return ()=>{ ipcRenderer.removeListener('electron-react-titlebar/maximize/change', onMaximimizeStateChange ); }; }, [browser window id]);constantsetMaximumize = useCallback(()=>{ ipcRenderer.send('electron-react-titlebar/maximize/set', browserWindowId); }, [browser window id]);constantsetMinimumize = useCallback(()=>{ ipcRenderer.send('electron-react-titlebar/minimize/set', browserWindowId); }, [browser window id]);constantsetClose = useCallback(()=>{ ipcRenderer.send('electron-react-titlebar/close', browserWindowId); }, [browser window id]);return( <div className="window-controls"> {/* eslint-disable-next-line react/button-has-type */} <button aria-label="minimize" tabIndex={-1} className="window -control de ventana-minimizar" disabled={disableMinimize} onClick={setMinimumize} > <svg aria-hidden="true" version="1.1" width="10" height="10"> <path d="M 0, 5 10,5 10,6 0,6 Z" /> </svg> </button> {/* eslint-disable-next-line react/button-has-type */} <button aria-label="maximize " tabIndex={-1} className="window-control window-maximize" disabled={disableMaximize} onClick={setMaximumize} > <svg aria-hidden="true" version="1.1" width="10" height=" 10"> <caminho d={ isMaximized ? 'm 2,1e-5 0,2 -2,0 0,8 8,0 0,-2 2,0 0,-8 z m 1,1 6,0 0, 6 -1,0 0,-5 -5,0 z m -2,2 6,0 0,6 -6,0 z' : 'M 0,0 0,10 10,10 10,0 Z M 1,1 9 ,1 9,9 1,9 Z' } /> </svg> </button> {/* eslint-disable-next-line react/button-has-type */} <button aria-label="close" tabIndex={-1} className="window-control window-close" onClick={setClose} > <svg aria-hidden="true" version="1.1" width="10" height="10"> <ruta d ="M 0,0 0,0,7 4,3,5 0,9,3 0,10 0,7,10 5,5,7 9,3,10 10,10 10,9,3 5,7 ,5 10,0,7 10,0 9,3,0 5,4,3 0,7, 0 Z" /> </svg> </button> </div> );}

Example #23

Source file:DbList.tsxFrom SeeQR under MIT license4wishesElectron IpcRendererEvent TypeScript Examples (45)Electron IpcRendererEvent TypeScript Examples (46)
DbList = ({SelectedDb, setSelectedDb, setSelectedView, display, }: DbListProps) => {constant[bases de datos, setDatabases] = useState<string[]>([]);constant[openAdd, setOpenAdd] = useState(FALSE);constant[openDupe, setOpenDupe] = useState(FALSE);constant[dbToDupe, setDbToDupe] = useState(''); useEffect(()=>{// Listen to the backend for updates to the list of available databases constantdbListFromBackend =(evt: IpcRendererEvent, dbLists: desconocido) =>{con(isDbLists(dbLists)) { setDatabases(dbLists.databaseList.map((Data bank) =>db.db_name)); } }; rendereripc.on('db lists', dbListFromBackend); solicitarDbListOnce();// return the cleanup function return ()=>{ ipcRenderer.removeListener('db lists', dbListFromBackend); }; });constanthandleClickOpenAdd =()=>{ setOpenAdd(TRUE); };constanthandleCloseAdd =()=>{ setOpenAdd(FALSE); };constanthandleClickOpenDupe =(db_name: string) =>{ setDbToDupe(dbNome); setOpenDupe(TRUE); };constanthandleCloseDupe =()=>{ setOpenDupe(FALSE); };constantselectHandler =(db_name: string) =>{// setSelectedView('dbView'); con(dbName ===dbseleccionado)return; ipcRenderer .invoke('select-db', db_name) .then(()=>{ setSelectedDb(dbName); }) .pegar(()=>post comments({type:'error',message:`Could not connect to${dbname}`, }) ); };con(!show)return null;return( <> <Tooltip title="Importar base de datos"> <IconButton onClick={handleClickOpenAdd}> <AddIcon fontSize="large" /> </IconButton> </Tooltip> <StyledSidebarList> {databases.map((dbName) => ( <DbEntry key={`dbList_${dbName}`} db={dbName} isSelected={selectedDb === dbName} select={selectHandler} duplicado={() => handleClickOpenDupe(dbName)} /> ))} {openDupe ? ( <DuplicateDbModal open={openDupe} onClose={handleCloseDupe} dbCopyName={dbToDupe} bases de datos={databases} /> ) : null} </StyledSidebarList> <AddNewDbModal open={openAdd} onClose={handleCloseAdd} bases de datos= {bancos de dados} /> </> );}

Example #24

Source file:NewSchemaView.tsxFrom SeeQR under MIT license4wishesElectron IpcRendererEvent TypeScript Examples (47)Electron IpcRendererEvent TypeScript Examples (48)
NewSchemaView = ({ consulta, setQuery, createNewQuery, setSelectedDb, selectedDb, show,}: NewSchemaViewProps) => {// additional local state properties using hooks constant[dbTables, setTables] = useState<TableInfo[]>([]);constant[selectedTable, setSelectedTable] = useState<TableInfo>();constant[currentSql, setCurrentSql] = useState('');constant[databases, setDatabases] = useState<DatabaseInfo[]>([]);constant[open, defineOpen] = useState(FALSE);constantdefault query: query data = {label:'',// required by the QueryData interface, but not required by this viewData bank:'',// name entered by the user in SchemaName.tsxcadena SQL:'',// sql string that the user inputs into SchemaSqlInput.tsxgroup:'' // group string to order queries in chords};constantlocalQuery = { ...defaultQuery, ...query }; useEfecto(()=>{// Listen to the backend for updates to the list of tables in the current database constanttableFromBackend =(evt: IpcRendererEvent, dbLists: desconocido) =>{con(isDbLists(dbLists)) { setDatabases(dbLists.databaseList); setTables(dbLists.tableList); setSelectedTable(selectedTable || dbLists.tableList[0]); } }; renderizadoripc.on('db lists', tabelasDeBackend); solicitarDbListOnce();// return the cleanup function return ()=>{ ipcRenderer.removeListener('db lists', tabelasDeBackend); }; });// handle schema naming constantonNameChange =(novoName: cadena) =>{ setQuery({ ...localQuery,Data bank: new name }); setSelectedDb(newName); };// handle the input sql string constantonSqlChange =(newSql: string) =>{// because the application job query changes refsetCurrentSql(newSql); setQuery({ ...localQuery,cadena sql: novoSql }); };// handles the initialization of the new schema constantenInitialize =()=>{ ipcRenderer.call('initialize-db', {newDBName: localQuery.db, }) .catch((err) =>{ post comments ({type:'error',message:err??'Error initializing db',}); }); }// handle the export constantinExport =()=>{ ipcRenderer.call('export-db', {fuenteDb:selectedDb }) .catch((err) =>{ post comments ({type:'error',message:err??'Error exporting database',}); }); }// onRun function to handle when the user submits a sql string to update the schema constanton Execute =()=>{ setSelectedDb(localQuery.db);// // ask the backend to execute the queryipcRenderer .invoke('update-db', {cadena sql: localQuery.sqlString, selectDb }) .then(()=>{setCurrentSql('');}) .to take((err) =>{ post comments ({type:'error',message:err??'Error updating schema',}); }); };con(!show)return null;return( <NewSchemaViewContainer> <TopRow> <SchemaName name={selectedDb} onChange={onNameChange}/> <InitButton variant="contained" onClick={onInitialize}>Inicializar banco de datos</InitButton> <ExportButton variant="contained" onClick ={ onExport}>Exportar</ExportButton> </TopRow> <SchemaSqlInput sql={currentSql} onChange={onSqlChange} runQuery={onRun} /> <CenterButton> <RunButton variant="contained" onClick={onRun}> Actualizar banco de dados < /RunButton> </CenterButton> <Container> <Typography variant="h4">{`${selectedDb}`}</Typography> </Container> <TablesTabs // setTables={setTables} tables={ dbTables} selectTable= {(table: TableInfo) => setSelectedTable(table)} selectedTable={selectedTable} selectedDb={selectedDb} /> </NewSchemaViewContainer>);}

Example #25

Source file:QueryView.tsxFrom SeeQR under MIT license4wishesElectron IpcRendererEvent TypeScript Examples (49)Electron IpcRendererEvent TypeScript Examples (50)
QueryView = ({ query, createNewQuery, selectedBase, setSelectedBase, setQuery, display, queries}:QueryViewProps) => {constant[bases de datos, setDatabases] = useState<string[]>([]);constantdefault query: query data = {label:'',Data bank: select DB,cadena sql:'',group:'',};constantlocalQuery = { ...defaultQuery, ...query };// Register the event listener that receives the database list for the database selectoruseEffect(()=>{constantreceiveDbs =(evt: IpcRendererEvent, dbLists: desconocido) =>{con(isDbLists(dbLists)) { setDatabases(dbLists.databaseList.map((Data bank) =>db.db_name)); } }; rendereripc.on('db lists',receiveDbs); requestDbListOnce();return ()=>{ ipcRenderer.removeListener('db lists',receiveDB); } });constantonLabelChange =(new tag: string) =>{ setQuery({ ...localQuery,label: new tag }); };constantonGroupChange =(newGroup: string) =>{ setQuery({ ...localQuery,group: new group }); };constantonDbChange =(newDb: string) =>{// when the database is changed, we should change the state of the selected database in the application, as well as // request updates to the database and table information. Otherwise database preview tab // will display incorrect informationipcRenderer .invoke('select-db', newDB) .then(()=>{ setQuery({ ...localQuery,Data bank: nuevaBD }); setSelectedDb(newDb); }) .tomar(()=>post comments({type:'error',message:`Could not connect to${nuevaDb}`, }) ); };constantonSqlChange =(newSql: string) =>{// because the application job query changes refsetQuery({ ...localQuery,cadena sql: novoSql }); };constanton Execute =()=>{con(!localQuery.label.trim()) { sendComment({type:'information',message:"Unlabeled queries will be executed but not saved",}); }con(!localQuery.group.trim()) { sendComment({type:'information',message:"Queries without a group will be executed but not saved",}); }// ask the backend to execute the queryipcRenderer .invoke('execute query', {dbtarget: localQuery.db,cadena sql: localQuery.sqlString, selectedDB, }) .then(({ db, sqlString, returnRows, expliqueResults, erro }) =>{con(error) {to throwerror }constanttransformed data = { sqlString, rows returned,execution plan: explain Results[0]['CONSULTATION PLAN'][0],label: localQuery.label, database,group: localQuery.group, };constantkeys:string[] =Object.keys(queries);for(leaveue =0; i < keys.length; i++){con(keys[i].include(`db:${localQuery.db}group:${localQuery.group}`)) {returnpost comments({type:'information',message:`${localQuery.db}already exists in${localQuery.group}`,}); }; }; createNewQuery(transformed data); }) .so(()=>{ consultalocal.sqlString =''; }) .to take((err) =>{ post comments ({type:'error',message:err??'Error executing query',}); }); };con(!show)return null;return( <QueryViewContainer> <TopRow> <QueryLabel label={localQuery.label} onChange={onLabelChange} /> <QueryGroup group={localQuery.group} onChange={onGroupChange} /> <QueryDb db={localQuery.db} onChange= {onDbChange} databases={databases} /> <QueryTopSummary queues={query?.returnedRows?.length} totalTime={getPrettyTime(query)} /> </TopRow> <QuerySqlInput sql={localQuery?.sqlString ??'' } onChange={onSqlChange} runQuery={onRun} /> <CenterButton> <RunButton variant="contained" onClick={onRun}> Execute Query </RunButton> </CenterButton> <QuerySummary ExecutionPlan={query? .executionPlan} / > <QueryTabs results={query?.returnedRows} executionPlan={query?.executionPlan} /> </QueryViewContainer> );}

Videos

1. Getting Started w/ Electron #4 - Inter Process Communication
(tylerlaceby)
2. TUTORIAL - Electron JS - Custom Title Bar / Frameless Window - IPC Main/IPC Renderer - MODERN GUI
(Wanderson)
3. ElectronJS Tutorial - Inter Process Communication Correct Method (2021)
(coderJeet)
4. Electron Main and Renderer Communication
(Antonin Januska)
5. IPC Main to IPC Renderer & Back in React.js - Electron S1 E4
(Keith, the Coder)
6. Create a Desktop App With JavaScript & Electron
(Traversy Media)
Top Articles
Latest Posts
Article information

Author: Van Hayes

Last Updated: 01/19/2023

Views: 6296

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.