admin管理员组文章数量:1430652
I am trying to test something here.
I am using electron and javascript. I am trying to load a profile into the page when a user selects it. None of my console log statements are showing in the console, however when the user makes the "profileSelect" change event, the values are loaded correctly. The reason I am testing this is because I am trying to add an addition to this file, checking a checkbox (it's not working either).
profileSelect.change(function(event) {
//If the value isn't null
console.log('yo')
if (profileSelect.val() == '') {
clearBilling();
} else {
ipcRenderer.once(profileSelect.val() + 'profileData', function(event, data) {
//Return card to style it was first added like
console.log('sshi')
//This allows us to parse the data on profile save
const cardParse = String(data.card.number).match(/.{3,4}/g).join(' ')
const dateParse = String(data.card.month) + ' / ' + String(data.card.year);
profileName.val(profileSelect.val());
billingFirstName.val(data.billing.firstName);
billingLastName.val(data.billing.lastName);
billingAddress1.val(data.billing.address1);
billingAddress2.val(data.billing.address2);
billingCity.val(data.billing.city);
billingState.val(data.billing.state);
billingZipcode.val(data.billing.zipcode);
billingCountry.val(data.billing.country);
billingPhone.val(data.billing.phone);
billingEmail.val(data.email);
shippingFirstName.val(data.shipping.firstName);
shippingLastName.val(data.shipping.lastName);
shippingAddress1.val(data.shipping.address1);
shippingAddress2.val(data.shipping.address2);
shippingCity.val(data.shipping.city);
shippingState.val(data.shipping.state);
shippingZipcode.val(data.shipping.zipcode);
shippingCountry.val(data.shipping.country);
shippingPhone.val(data.shipping.phone);
cardName.val(data.card.name);
cardNumber.val(cardParse);
cardCVV.val(data.card.code);
cardExpire.val(dateParse);
})
//Send the selected profile
ipcRenderer.send('requestProfile', profileSelect.val())
}
})
Why aren't the console log statements logging? Thanks for any input :)
I am trying to test something here.
I am using electron and javascript. I am trying to load a profile into the page when a user selects it. None of my console log statements are showing in the console, however when the user makes the "profileSelect" change event, the values are loaded correctly. The reason I am testing this is because I am trying to add an addition to this file, checking a checkbox (it's not working either).
profileSelect.change(function(event) {
//If the value isn't null
console.log('yo')
if (profileSelect.val() == '') {
clearBilling();
} else {
ipcRenderer.once(profileSelect.val() + 'profileData', function(event, data) {
//Return card to style it was first added like
console.log('sshi')
//This allows us to parse the data on profile save
const cardParse = String(data.card.number).match(/.{3,4}/g).join(' ')
const dateParse = String(data.card.month) + ' / ' + String(data.card.year);
profileName.val(profileSelect.val());
billingFirstName.val(data.billing.firstName);
billingLastName.val(data.billing.lastName);
billingAddress1.val(data.billing.address1);
billingAddress2.val(data.billing.address2);
billingCity.val(data.billing.city);
billingState.val(data.billing.state);
billingZipcode.val(data.billing.zipcode);
billingCountry.val(data.billing.country);
billingPhone.val(data.billing.phone);
billingEmail.val(data.email);
shippingFirstName.val(data.shipping.firstName);
shippingLastName.val(data.shipping.lastName);
shippingAddress1.val(data.shipping.address1);
shippingAddress2.val(data.shipping.address2);
shippingCity.val(data.shipping.city);
shippingState.val(data.shipping.state);
shippingZipcode.val(data.shipping.zipcode);
shippingCountry.val(data.shipping.country);
shippingPhone.val(data.shipping.phone);
cardName.val(data.card.name);
cardNumber.val(cardParse);
cardCVV.val(data.card.code);
cardExpire.val(dateParse);
})
//Send the selected profile
ipcRenderer.send('requestProfile', profileSelect.val())
}
})
Why aren't the console log statements logging? Thanks for any input :)
Share Improve this question asked Apr 16, 2018 at 21:12 lylecarlsonlylecarlson 612 silver badges6 bronze badges 4- Which console are you looking at? Last time I worked with electron I remember that there was the mand console window showing, as well as the developer tools for the "browser" view itself. Different parts of the app wrote to their appropriate console. Are you checking both? – BryanGrezeszak Commented Apr 16, 2018 at 21:38
- Look at the source inspector inside your electron window and step through code to see what is running – tic Commented Apr 16, 2018 at 22:18
- @BryanGrezeszak Yes, I work frequently with Electron. It should be showing in the dev tools console. It doesn't show in either – lylecarlson Commented Apr 16, 2018 at 22:43
-
Does your app have a webview? If so, are you looking at the devtools console from
window.webContents.openDevTools()
or...webview.openDevTools()
? Make sure you're not accidentally looking at the wrong dev tools. Second, make sure your devtools doesn't have any filters on it. – pushkin Commented Apr 18, 2018 at 22:18
1 Answer
Reset to default 6Electron has 2 processes, and hence 2 consoles. The 2 processes are main and renderer, main being a node.js process, renderer being a browser process.
Main process console.log
would be shown in the terminal (if running in dev) or in the browser console window if in the renderer process.
You seem to be logging from the renderer process as per the ipcRenderer
statements.
The renderer console can be shown via the standard chrome devtools shortcut (as its running a chrome instance) (usually F12)
You won't be able to see any console statements from renderer in main, or main in renderer.
本文标签: javascriptWhy are these consolelog statements not working ElectronStack Overflow
版权声明:本文标题:javascript - Why are these console.log statements not working? Electron - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745451071a2658886.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论