Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

electron ipc from main to renderer

// 4. The main process sends messages to the rendering process proactively

// The main process sends a message to the rendering process.

    // ipcMain.js
    const {BrowserWindow} = require("electron");

    BrowserWindow.getFocusedWindow().webContents.send(
        "rendererMsg",
        {msg:"Messages proactively sent by the main process to the rendering process"}
    )                    

// The rendering process listens for messages sent by the host process.

    // ipcRenderer.js
    const {ipcRenderer} =require("electron");

    window.onload = () => {
        // Listen for messages sent by the host process on its own initiative
        ipcRenderer.on("rendererMsg",(e,data)=>{
            console.log(data);
            // {'msg':'Messages proactively sent by the host process to the rendering process'}
        });
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: math random javascript 
Javascript :: node js clear cache 
Javascript :: how to avoid duplicate values in dropdownlist using jquery 
Javascript :: discord js if no arguments 
Javascript :: cek versi node js 
Javascript :: how to import in react js 
Javascript :: js how to get max sub array sum 
Javascript :: global execution context javascript 
Javascript :: How to update one mongoose db 
Javascript :: react vscode stop auto close tag 
Javascript :: javascript substring 
Javascript :: Iterate with Do While Loops Javascript 
Javascript :: includes not working 
Javascript :: angular http async false 
Javascript :: how set type of string value to number in js 
Javascript :: how to check if email already exists in database using javascript 
Javascript :: Javascript Event Loop 
Javascript :: how to use nodemailer 
Javascript :: how to run react native app on simulator 
Javascript :: javascript console.log() method in browser 
Javascript :: searc and replace fcc solution 
Javascript :: Add remove link dropzone 
Javascript :: substr method 
Javascript :: moves zeroes 
Javascript :: how to check if string is valid jwt 
Javascript :: date format in javascript 
Javascript :: set date to input date 
Javascript :: url_for javascipt 
Javascript :: wheel 
Javascript :: Accessing user input through js 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =