De­bug­ging

Web Designer - - Build Progressive Web Apps With Workbox -

The be­hav­iour of ser­vice work­ers can be con­fus­ing to start with be­cause they keep run­ning in the back­ground, so re­fresh­ing the page might not al­ways do what you ex­pect. As a re­sult, as you start out we’d sug­gest in­clud­ing fre­quent con­sole log­ging in your code to help fol­low what’s hap­pen­ing. Ad­di­tion­ally, Chrome De­vel­oper Tools can pro­vide de­tailed in­sight into the ser­vice work­ers on a page. In De­vel­oper Tools, nav­i­gate to the Ap­pli­ca­tion tab and you’ll see a Ser­vice Work­ers tab. It’s par­tic­u­larly worth not­ing that you can man­u­ally up­date and un­reg­is­ter ser­vice work­ers on this page, which is help­ful when de­vel­op­ing to en­sure you pick up the lat­est changes. Ad­di­tion­ally, the Clear Stor­age tab will en­able you to purge cached re­sources, which can also come in very use­ful. Once you have Work­box up and run­ning and han­dling your caching, you’ll also find that it pro­vides its own very rich con­sole mes­sages which are cer­tainly worth keeping an eye on.

Newspapers in English

Newspapers from UK

© PressReader. All rights reserved.