javascript - Why are these console.log statements not working? Electron - Stack Overflow

I am trying to test something here.I am using electron and javascript. I am trying to load a profile in

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
Add a ment  | 

1 Answer 1

Reset to default 6

Electron 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745451072a4628270.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信