/** * Opens up simulator within IDE window by sending a message to ipcRenderer('start simulator') * Changes state of simulator to true to trigger conditional rendering of Editor and Simulator */ openSimulatorInMain() { if(this.state.simulator === false){ this.setState({ simulator: true }); ipcRenderer.send('start simulator', 'helloworld'); } else { this.closeSim() } }
/** * Open up the simulator by sending a message to ipcRenderer('openSimulator') */ openSim() { ipcRenderer.send('openSimulator', 'helloworld'); }
closeSim() { this.setState({ simulator: false }); ipcRenderer.send('closeSim', this.state.liveServerPID); }
/** * sends input name to main, where the file/directory is actually created. * creation of new file/directory will trigger watch handler */ createItem(event) { if (event.key === 'Enter') { //send path and file type to main process to actually create file/dir only if there is value if (event.target.value) ipcRenderer.send( 'createItem', this.state.selectedItem.path, event.target.value, this.state.createMenuInfo.type ); //set type of file change so watch handler knows which type this.setState({ fileChangeType: 'new' }); } }
//handles click event from delete prompt deletePromptHandler(answer) { if (answer) { ipcRenderer.send('delete', this.state.selectedItem.path); } else { this.setState({ fileChangeType: null }); } this.setState({ deletePromptOpen: false }); }
electron.ipcRenderer.send("quitApp");
}); ipcRenderer.send('closeSplash');
const logger = ( namespace, options ) => { // FIXME: The `remote` module is being deprecated and will be excluded // from Electron v9.x. // It is possible to use the `remote` module to directly require the // main process logging module. However, this is a security concern and is // discouraged. Instead, we post log messages to the main process via ipc. const send = ( level, message, meta ) => { ipcRenderer.send( 'log', level, namespace, options, message, meta ); }; return { error: ( message, meta ) => send( 'error', namespace, options, message, meta ), warn: ( message, meta ) => send( 'warn', namespace, options, message, meta ), info: ( message, meta ) => send( 'info', namespace, options, message, meta ), debug: ( message, meta ) => send( 'debug', namespace, options, message, meta ), silly: ( message, meta ) => send( 'silly', namespace, options, message, meta ), }; }
/** * sends old path and new name to main process to rename, closes rename form and sets filechangetype and newName for fswatch * @param {Javascript event Object} event */ renameHandler(event) { if (event.key === 'Enter' && event.target.value) { ipcRenderer.send('rename', this.state.selectedItem.path, event.target.value); this.setState({ renameFlag: false, fileChangeType: 'rename', newName: event.target.value }); } else if (event.key === 'Enter' && !event.target.value) { this.setState({ renameFlag: false }); } let copyObj = { createMenuInfo: { id: null, type: null } } this.setState({ createMenuInfo: copyObj, openMenuId: null }); }
} else if (actionType === 'delete') { ipcRenderer.send('delete', path); this.setState({ fileChangeType: 'delete'
ipc.on('render-overlay-icon', (event, unreadsCount) => { ipc.send( 'update-overlay-icon', renderOverlayIcon(unreadsCount).toDataURL(), unreadsCount.toString(), ); });
// Set an interval to the dmpTimer variable function startAutoDump() { dmpTimer = setInterval(function () { if (prefs.updStat[0] === 'downloaded') { setStatTxt('Update Downloaded..'); ipcRenderer.send('upd-import', [prefs.updStat[1], prefs.updStat[2], prefs.keepDL]); } else { setStatTxt('Checking for updates..'); ipcRenderer.send('upd-dump', [prefs.updURL, prefs.updType, prefs.updLast]); // [URL, <type>] } }, (prefs.updInt * 60) * 1000); }
// Fired after dump file is successfully downloaded ipcRenderer.on('upd-dump-success', function (event, data) { prefs.updStat = ['downloaded', data[0], data[1]]; setStatTxt('Update Downloaded..'); ipcRenderer.send('upd-import', [data[0], data[1], prefs.keepDL]); });
function search () { const formInput = window.document.querySelector('form input'); const term = formInput.value; ipcRenderer.send('monitorTerm', term); return false; }