Yuav ua li cas koj debug ib tug electron?
Yuav ua li cas koj debug ib tug electron?

Video: Yuav ua li cas koj debug ib tug electron?

Video: Yuav ua li cas koj debug ib tug electron?
Video: Ib tug txiv tsev zoo coj li cas 2024, Tej zaum
Anonim

Hluav taws xob - Kev debugging . Peb muaj ob txheej txheem uas khiav peb daim ntawv thov - cov txheej txheem tseem ceeb thiab cov txheej txheem renderer. Txij li cov txheej txheem renderer yog ib qho raug tua hauv peb lub qhov rais browser, peb tuaj yeem siv Chrome Devtools rau debug nws. Txhawm rau qhib DevTools, siv qhov shortcut "Ctrl+Shift+I" lossis tus yuam sij.

Li ntawd, koj yuav ua li cas debug ib qho app electron?

Kev debugging Cov txheej txheem tseem ceeb js cov ntawv thov, tsis txaus siab los ntawm Hluav taws xob . Koj tuaj yeem pib koj Kev siv hluav taws xob hauv debug hom siv cov -- debug chij, uas yuav-los ntawm default-enable tej thaj chaw deb debugging ntawm qhov chaw nres nkoj 5858. Kev txhawb nqa txwv tsis pub siv Node Inspector nrog Hluav taws xob muaj nyob rau hauv cov ntaub ntawv raug cai.

Tsis tas li ntawd, ua li cas koj qhib lub console ntawm electron app?

  1. Hauv koj lub app nplaub tshev npm nruab --save-dev electron-react-devtools.
  2. Qhib koj lub app electron, nyem rau ntawm (saib/toggle developer tools). Hauv console tab ntxig cov lej hauv qab no thiab ntaus nkag: xav tau ('electron-react-devtools').install()

Ua raws li qhov xav tau, koj yuav ua li cas debug lub tshuab hluav taws xob hauv VS code?

Kev debugging Cov txheej txheem tseem ceeb mus rau qhov Debug saib thiab xaiv qhov ' Hluav taws xob : Main 'configuration, ces nias F5 los yog nias lub khawm ntsuab ua si. VS Code yuav tsum tam sim no sim pib koj Electron app , thiab koj qhov breakpoint ntawm kab 16 hauv lub ntsiab. js yuav tsum raug ntaus.

Kuv yuav hloov kho kuv lub app electron li cas?

Txoj kev yooj yim tshaj plaws los siv qhov kev pabcuam no yog los ntawm kev txhim kho hloov tshiab - hluav taws xob - app , ib Node. js module preconfigured rau siv nrog hloov tshiab .electronjs.org. Los ntawm lub neej ntawd, qhov module no yuav kuaj rau tshiab ntawm app pib, ces txhua kaum feeb. Thaum ib hloov tshiab pom, nws yuav cia li rub tawm hauv keeb kwm yav dhau.

Pom zoo: