Jump to content

How to pass a value rather than object ?


vmars316

Recommended Posts

Greetings ,

How to pass a value rather than object ?
 
main.js (sends a msg to renderer.js)
view.webContents.on('did-start-navigation', (event, url) => {
    console.log("2  main.js 'did-start-navigation' =  " + url)
 win.webContents.send('Send-url', url) ;   
}) // 'did-start-navigation'


preload.js  (receives message from main.js , them preload.js plugs message into id="url")
ipcRenderer.on('Send-url', holdUrl => {
  document.getElementById("url").value = holdUrl;
  console.log('2 holdUrl = ' +  holdUrl) 
})

index.html
<input id="url" type="url" value="https://google.com"/>

But what gets plugged into <input> is this:   '[object Object]' 

How do I pass a value , not an object ?

Thanks

 

Link to comment
Share on other sites

preload.js

ipcRenderer.on('Send-url', url => {
  console.log('2 url = ' +  url) 
  document.getElementById("url").value = url ;
  console.log('2 url = ' +  url) 
})

main.js

view.webContents.on('did-start-navigation', (event, url) => {
    console.log("2  main.js 'did-start-navigation' =  " + url)
 win.webContents.send('Send-url', url) ;   
}) // 'did-start-navigation'

https://gist.github.com/58b504c9cd156eacb71dbfe4238a3066

Edited by vmars316
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...