Intro To Service Workers & Caching

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 352

  • @taariqq
    @taariqq 6 ปีที่แล้ว +82

    Brad, thank you for keeping it vanilla. Oh, and thank you for teaching us the important stuff that some of us did not even know was important.

  • @hamzajirah
    @hamzajirah 5 ปีที่แล้ว +10

    I have lost count of how many times my search leads me to your channel. I owe a good part of my dev knowledge and skills to your courses on TH-cam and Udemy. Thanks Brad.

  • @adriandinca5682
    @adriandinca5682 6 ปีที่แล้ว +15

    Thank you Brad for always staying up to date and posting regularly!
    I think that the approach you have used only serves content from the cache when the user is completely offline, but when the user is on a very slow connection the code still goes to the network and does not get the content from the local storage first. It is true that by using this approach you get the latest content no matter what, but PWAs are meant to be fast no matter what the connection type is like, serving the content from the cache and then going to the network would yield faster results.
    Here is how I would achieve that. Inside the fetch event listener I would respond with
    e.respondWith(
    // look for a match inside all caches
    caches.match(e.request)
    // if there is a cached version of the request serve that otherwise go to the network
    .then(response => response || fetch(e.request))
    );
    I know this video is not exactly about PWAs, but I think the service worker is mainly used with them.
    Please correct me if I am wrong.
    P.S. YOU ARE AWESOME! :D

    • @OnePieceWonPeace
      @OnePieceWonPeace 9 หลายเดือนก่อน

      Totally appreciate your comment here. You bring up a really good point and, for the argument you make, you're totally right. I think, tho, there are actually 2 preferences one could have. 1) Like your own, you prefer speed at the cost of a somewhat stingy/sticky cache. 2) A fault tolerant strategy that prefers the latest at the cost of speed.
      I think it really depends on what the mission of the app ultimately is.

  • @tommyatkins4806
    @tommyatkins4806 3 ปีที่แล้ว +1

    Best Dev channel I've found on TH-cam!

  • @lsd22252
    @lsd22252 6 ปีที่แล้ว +1

    Service workers are an amazing capability that enable PWAs to deliver Store App like capabilities without needing the overhead of inclusion in the Apple, Google or Microsoft Store. Local cache first options mean that PWA apps can function offline after they've been run once from the Browser. They can also be installed to run from a home screen. Over the last few years Google, in particular, have improved the PWA experience to prime time level but all evergreen Browsers do, or will shortly, fully enable other PWA compliance requirements as well Thx Brad. Your great coverage will give us all a better understanding of the skills required to build PWAs . . . starting with the service worker. I ♥ PWAs.

  • @sivach8667
    @sivach8667 3 ปีที่แล้ว

    Thanks a lot...Not just for delivering great content but also for avoiding annoying and unrelated starting music.

  • @claudwatari
    @claudwatari 4 ปีที่แล้ว +1

    2 years later, I came here & I'm happy with this tutorial. Thanks Brad.

  • @Shipx7
    @Shipx7 2 ปีที่แล้ว

    My instructor assigned almost TEN HOURS worth of Indeed videos explaining service workers, and I couldn't really understand them because they were so dry. You managed to explain what they are, what they're used for, and how to implement them in a basic form in half an hour without overloading my monkey-brain. Bravo.

  • @overthinkinglisa
    @overthinkinglisa 6 ปีที่แล้ว +13

    me: on a call with older-school dev explaining service workers to him and that we should use them
    brad: releases video explaining service workers, youtube notification pops up
    me: weeps with joy

    • @StijnHommes
      @StijnHommes 3 ปีที่แล้ว

      New isn't better. The other developer is right to not jump on the mindless bandwagon by helping to produce PWA spam. They're probably designing real apps instead of repurposed websites.

    • @EnglishTurkishExpert
      @EnglishTurkishExpert 7 หลายเดือนก่อน

      illuminati 😁😁😁😁

  • @magxtopher1332
    @magxtopher1332 6 ปีที่แล้ว

    You are blessed with explanations of every details and your teaching is easy and simple.But I now know the secrets: Hard work and passion.Thanks.

  • @lolismelolisme7546
    @lolismelolisme7546 6 ปีที่แล้ว +105

    Thanks Brad, always producing quality content.

    • @TraversyMedia
      @TraversyMedia  6 ปีที่แล้ว +7

      Thanks for watching :)

    • @mooodddy1
      @mooodddy1 5 ปีที่แล้ว

      Thanks brad, plz make video about work box toturial

  • @thetechnerdco
    @thetechnerdco 4 ปีที่แล้ว

    For those that were following along and couldn't get the 'sw_cached_site.js' to work, go back in your main.js and make sure the service worker that is registered is pointing to the correct file. Took me a minute lol because I followed this at 1.5x and learned it too! Thanks Brad! :)

  • @thanasisathanasi4965
    @thanasisathanasi4965 5 ปีที่แล้ว +4

    Best video on Service Workers in TH-cam! I subscribed in the channel without delay

  • @AegirAexx
    @AegirAexx 5 ปีที่แล้ว +1

    Wondering about Service Workers...
    Going to TH-cam and search for Service Workers...
    Of course Traversy Media has a short introduction about the subject.
    Brad, you magnificent beast, I love you! Keep up the awesome work!

  • @adryanyudhatrisna1944
    @adryanyudhatrisna1944 6 ปีที่แล้ว

    Brad deserves more than 1M subscribers, because his videos are so cool... Keep it up brad!

  • @shankerm3959
    @shankerm3959 5 ปีที่แล้ว

    The beauty of Brad's lessons is you come in to learn something and you pick up a dozen new things.

  • @srcmake
    @srcmake 6 ปีที่แล้ว

    Literally every single video you make is premium god-tier content. Awesome video, thanks for teaching/demoing about caching.

  • @clockwerkz
    @clockwerkz 6 ปีที่แล้ว +3

    I'm *just* getting to Service Workers in my Udacity Course, this is awesome timing! Thank you Brad!

    • @forrestang
      @forrestang 6 ปีที่แล้ว +2

      Same here... I hate this Udacity Course :)

    • @rafaelxrafael
      @rafaelxrafael 6 ปีที่แล้ว

      ahhaha #team_udacity here too

  • @masnoonjunaid
    @masnoonjunaid 5 ปีที่แล้ว +5

    Thanks ! I messed for 10 days and finally victorious at this video, God bless you.

  • @supindersingh8882
    @supindersingh8882 4 ปีที่แล้ว +1

    Most of the time you solve my code problems. Thank you!

  • @dibils
    @dibils 10 หลายเดือนก่อน

    thanks for this, by far the best instructions on getting started with service workers!

  • @milosh996
    @milosh996 6 ปีที่แล้ว

    These crash courses are gems. Thank you.

  • @hnasr
    @hnasr 5 ปีที่แล้ว +3

    Amazing tutorial dude! Learned lot!

  • @gabiold
    @gabiold 5 ปีที่แล้ว

    Thank you! Your presentation style is sooo clear, your videos are the best!
    You achive the understanding not by painfully slowing down talking and overexplaining things, but just clearly explaining what's going on, focusing clearly on topic, nothing else, nothing more, nothing less.
    Can you do a video about client-side databases, especially IndexedDB?
    Possibly mentioning some in-memory DB solutions, and comparing them, what's best for what.
    Sorry if you did that already, I couldn't find it yet.

  • @KevinSheppard
    @KevinSheppard 6 ปีที่แล้ว

    Thanks Brad! I was a bit afraid of Service Workers but this tutorial made me feel more confident about trying them out.

  • @axelruiz3015
    @axelruiz3015 3 ปีที่แล้ว

    I have had problems with service workers, but you made it very easy to understand, thank you :3

  • @samachema
    @samachema 6 ปีที่แล้ว

    Service Worker is becoming a big deal these days. Appreciate you doing an intro on this.

  • @billypentester
    @billypentester 2 ปีที่แล้ว

    your explanation, concept cases and clean code help better to understand

  • @singaporestreettravel
    @singaporestreettravel 6 ปีที่แล้ว

    Thanks Brad giving short but quality information about workers... Keep going on...

  • @sumitkumarsingh9202
    @sumitkumarsingh9202 6 ปีที่แล้ว +2

    Thanks Brad, it's really the best content for the freshers like me.

  • @jagadeeshmanoharan9613
    @jagadeeshmanoharan9613 6 ปีที่แล้ว +3

    Every new video from Brad gives me a confidence.

  • @peterfeng208
    @peterfeng208 5 ปีที่แล้ว

    Thanks Brad, your video just solved the last piece of puzzle for me to work on the ERP as web application with PWA implementation.

  • @eacarvalho
    @eacarvalho 6 ปีที่แล้ว +1

    Thank you so much, Brad. I've been learning a lot from your tutorials. Yesterday, I bought your modern javascript at udemy and I can't wait to start it.

  • @OnePieceWonPeace
    @OnePieceWonPeace 9 หลายเดือนก่อน

    Thank you man! This was more than just MANY sanity checks, it literally dig me out of a hole in a couple spots. I only wish you spoke more about the diff better the fetch handler between each Service Worker and elaborate on why you cloned the request in the 2nd strategy. That said, loved the tutorial. Thank you again.

  • @bitcode_
    @bitcode_ 5 ปีที่แล้ว

    I've bought your courses and learned a lot, I got here again from searching exactly for my search query, your channel has become "thenewboston++" and I love it!

  • @sphengle
    @sphengle 5 ปีที่แล้ว

    Excellent. Very clear introduction.

  • @AneesKhan-uz4mz
    @AneesKhan-uz4mz 6 ปีที่แล้ว

    Finally a worth watching channel :), make me feel very happy, Love Mr.Brat god bless you

  • @Q6ri1990
    @Q6ri1990 6 ปีที่แล้ว

    Thank you for the awesome guide. I’ve been having some difficulties in understanding Web workers, but now I have a better understanding thanks to you.

  • @sourandbitter3062
    @sourandbitter3062 4 ปีที่แล้ว

    Brad, always there to save the day.

  • @serhiimamedov
    @serhiimamedov 3 ปีที่แล้ว

    I was trying learn it myself with official docs.
    The worker was registered successfully but I wasn't getting any logs from service worker.
    I was trying to find the answers but nether docs, googling nor stackowerflow helped.
    Couldn't understand what is the problem.
    But thanks to you I understand I just needed to check that "Preserve log" checkbox.
    Thanks Brad!

  • @HarshSingh-hk8fe
    @HarshSingh-hk8fe ปีที่แล้ว

    😀thanks alot sir for this incredible tutorial the way you teaches is just wow.

  • @IngenieroJorgeIvan
    @IngenieroJorgeIvan 5 ปีที่แล้ว +2

    The best service worker tutorial.
    Gracias.

  • @varletconstundefined
    @varletconstundefined 5 ปีที่แล้ว

    i never came to this channel and left not understanding what i am looking for.
    before even watching 2 min.
    Like and i'm sure i will get service workers perfectly (Y)

    • @varletconstundefined
      @varletconstundefined 5 ปีที่แล้ว

      Now I'm Back after intensive studying for the video.
      Masterpiece really easy to follow (Y)

  • @omegakofi2605
    @omegakofi2605 4 ปีที่แล้ว

    I was researching about different ad networks and I came to know about MonadPlug advertising network a few weeks ago. The revenue is pretty good for the ad formats I’ve tested (push notifications and native ads). Their live support is super helpful!

  • @RabbaniRasha
    @RabbaniRasha 3 ปีที่แล้ว

    Thank you so much sir! I managed to convert my site to PWA and Chrome showed install prompt after applying your tutorial.

  • @sasayaki
    @sasayaki 6 ปีที่แล้ว

    Thank you for this. I've been confused for days. You are the great explainer, Brad 😊

  • @olowolafemodupe6583
    @olowolafemodupe6583 6 ปีที่แล้ว

    Thank you Brad. You made this so easy for me to learn.

  • @AneesKhan-uz4mz
    @AneesKhan-uz4mz 6 ปีที่แล้ว

    Admit it guys, Brad is the best instructor ever

  • @jamalabdullahi8155
    @jamalabdullahi8155 6 ปีที่แล้ว +1

    This is what I have been waiting thanks brad

  • @DavidJohnson-hb6gh
    @DavidJohnson-hb6gh 5 ปีที่แล้ว

    Great video! Concise, yet detailed, and comprehensive.

  • @irrefl1672
    @irrefl1672 5 ปีที่แล้ว

    Quality content. Thanks. From Honduras.

  • @HaraldEngels
    @HaraldEngels 5 ปีที่แล้ว

    Excellent video. Very informative and well structured. Thank you for your efforts to produce and share it.

  • @sunkanmifafowora9402
    @sunkanmifafowora9402 5 ปีที่แล้ว

    Thanks brad for this. You make this fun and enjoyable. You are also a really good tutor. I am wondering why this video doesn't have more than 100,000 views lol. Please keep up the good work

  • @RickBeacham
    @RickBeacham 5 ปีที่แล้ว

    Thanks for vanilla and showing us the basics. Alot of great information. Cheeers.

  • @lightinthedark5708
    @lightinthedark5708 5 ปีที่แล้ว +1

    WoW!! Awesome!! Thanks, Brad!
    This is very helpful!!

  • @rutwickgangurde3247
    @rutwickgangurde3247 4 ปีที่แล้ว

    Great tutorial! Thanks. And props for using plain JavaScript.

  • @skilled-person
    @skilled-person 6 ปีที่แล้ว

    Thanks Brad, you always save the day... to bad TH-cam don't have 5 stars rating for channels :(

  • @pegasusteam
    @pegasusteam 6 ปีที่แล้ว

    Great overview of Service Workers Brad. Thanks!

  • @georgekrax
    @georgekrax 4 ปีที่แล้ว

    Much better than Google's Progressive Web Apps (PWA) course on Udacity!

  • @OfficialChoiceTV
    @OfficialChoiceTV 6 ปีที่แล้ว

    Oh man, you just opened a whole new world of possibility for me.

  • @karlheinzneugebauer
    @karlheinzneugebauer 6 ปีที่แล้ว

    Screw those few ones who disliked this video. If they don't get it after watching it, they must be dumb as a rock. Keep up the good content, Brad!

  • @aashirkhan5172
    @aashirkhan5172 6 ปีที่แล้ว +4

    Thanks Brad, But I have a confusion regarding main.js file in main.js you were the only register sw_cached_pages.js. Confusion is that how sw_cached_site.js can works if it not registered in main.js.

  • @KonstantinJivkov
    @KonstantinJivkov 6 ปีที่แล้ว +1

    Brad, you are amazing person! Thank you!

  • @HI-wq5vh
    @HI-wq5vh 3 ปีที่แล้ว

    Thanks Brad. Like always love your work and thanks for sharing.

  • @vicjtav
    @vicjtav 5 ปีที่แล้ว

    This is a great introduction to service workers brad. Thanks 🙏

  • @adante407
    @adante407 6 ปีที่แล้ว

    Brad Traversy & Shaun Pelling aka The Net Ninja. It's all anyone needs.

  • @logkdogk
    @logkdogk 5 ปีที่แล้ว

    Awesome one, so helpful for so many sites!

  • @JimmyBOnYouTube
    @JimmyBOnYouTube 6 ปีที่แล้ว +1

    My favorite flavor happens to be _vanilla_ so thanks for serving Brad!

  • @sachindraragul1094
    @sachindraragul1094 3 ปีที่แล้ว

    Great explanation. Thanks for the tutorial.

  • @11211211T
    @11211211T 6 ปีที่แล้ว

    Beautifully explained!

  • @ramis2963
    @ramis2963 ปีที่แล้ว

    Thanks brad, great content.
    greetings from syria

  • @gopinathkrm58
    @gopinathkrm58 6 ปีที่แล้ว

    Thanks Brad. Keep up your great efforts.

  • @kevinzhang8974
    @kevinzhang8974 6 ปีที่แล้ว

    Happy Friday to everyone. Thanks Brad for another great one for this latest technology. Now, it forces me stop doing other things and complete this first .... :-)

  • @zen-ventzi-marinov
    @zen-ventzi-marinov 4 ปีที่แล้ว

    Guys, what in your opinion makes a somebody a good teacher? I mean, what is the cause? Why do some become so good at explaining things so well and others can't?
    P.S. Thanks for the video. Ops, the channel. Ops, for doing what you do. Ops for existing. Ops, for having to deal with overenthusiastic comments such as this one.

  • @IamMclov1n25
    @IamMclov1n25 6 ปีที่แล้ว

    Another solid video, thanks Brad.

  • @Xandr017
    @Xandr017 5 ปีที่แล้ว

    outstanding video, really clear explanation

  • @marioleon86
    @marioleon86 6 ปีที่แล้ว

    Thanks good introduction practical enough more than many I found

  • @davidconnelly
    @davidconnelly 6 ปีที่แล้ว +1

    Awesome work, Brad.

  • @jellycoding
    @jellycoding 6 ปีที่แล้ว +6

    It says uploaded 4 min ago. And it already has 27 thumbs up. That's cool!

    • @TraversyMedia
      @TraversyMedia  6 ปีที่แล้ว +6

      I have the best subscribers/followers on TH-cam. I genuinely mean that. I have never seen a better, more positive and encouraging audience. I frigging love you guys :)

    • @onecarwood
      @onecarwood 6 ปีที่แล้ว +1

      Traversy Media that’s a great reflection on you Bro!

  • @Mvrck44
    @Mvrck44 4 ปีที่แล้ว

    Thank you for the video, it made possible to build my first cached site!
    One remark though, instead of caching 'index.html' that led to unreliable behaviour, I ended up using '/', what I've seen done elsewhere, and works steady now. It allowed me to stop using the 'Update on reload' checkbox too.

  • @malikgenius4u
    @malikgenius4u 6 ปีที่แล้ว

    awesome video Brad, you did it again. will wait for a full flagged React with service workers and push notifications course on udemy or youtube ... keep it up bro.

  • @amritadhikari9194
    @amritadhikari9194 2 ปีที่แล้ว

    Thanks Brad. This helped a lot.

  • @AbhishekKumar-mq1tt
    @AbhishekKumar-mq1tt 6 ปีที่แล้ว +1

    Thank you for this awesome video, I am waiting for next PWA video

  • @lostheptapod6382
    @lostheptapod6382 6 ปีที่แล้ว +1

    Nice, thanks for this tutorial, one remark though: technically you don't call events, the browser calls your event handlers, so saying that we call the install event is not correct

  • @omarsh82
    @omarsh82 2 ปีที่แล้ว

    Vanilla is the best flavour...Great video

  • @shivammishra6630
    @shivammishra6630 4 ปีที่แล้ว

    Thanks Brad, this was really helpful!

  • @maleselatlousetwaba9973
    @maleselatlousetwaba9973 2 ปีที่แล้ว

    Thanks Alot For This Tutorial Brad.

  • @Jadestonk
    @Jadestonk 3 ปีที่แล้ว

    Good video Brad, I know I come a liitle late but you should first check if the resource is in the cache before fetching, otherwise you'll be fetching every time instead of using the cached version (in case there is). But understand you wanted to focused on the offline version response. Thank you man.

  • @pravinkumar-lz2jm
    @pravinkumar-lz2jm 6 ปีที่แล้ว +1

    Thank you so much for this quality content(as always)

  • @kbcarte420
    @kbcarte420 6 ปีที่แล้ว

    I literally just learned about these in a podcast I listen to.

  • @vivekvanga3588
    @vivekvanga3588 6 ปีที่แล้ว

    Thanks Brad.. big fan of your channel..

  • @jamviking
    @jamviking 3 ปีที่แล้ว

    An eye opener... thanks a mil.

  • @reassume4826
    @reassume4826 4 ปีที่แล้ว

    Wow. Such a valuable tutorial. Thanks Man!

  • @rafaelxrafael
    @rafaelxrafael 6 ปีที่แล้ว

    what a cleannnn explanation! thanks

  • @pedroserapio8075
    @pedroserapio8075 6 ปีที่แล้ว

    Great, really simple and on point.

  • @kazinayem2011
    @kazinayem2011 4 ปีที่แล้ว

    Hey Brad, Whenever i search for something, firstly i check content from Traversy Media. You are very cool. Thanks a lot. It would be very helpful if any content for CRUD operations to sync to DB whenever we are from offline to online.

  • @shahzaibkhan-md9xw
    @shahzaibkhan-md9xw 6 ปีที่แล้ว +2

    Brad, you're great thank you for this tutorial

  • @fdc_8507
    @fdc_8507 6 ปีที่แล้ว +1

    this comes in the right time for me :) thanks

    • @kisali777
      @kisali777 6 ปีที่แล้ว

      awesome brad has ability to read people's mind

  • @bhabanishankardash1443
    @bhabanishankardash1443 6 ปีที่แล้ว +1

    Excellent & Excellent & Excellent. No words to say about your technical understanding of the basic things.
    2 Basic questions i hv: What Theme Style presently u using in VS code ?
    Please make another tutorial of basic understanding about the PWA "Manifest" file creation.
    Thanks in advance sir.

  • @Serjgap
    @Serjgap 5 ปีที่แล้ว +1

    But what is the difference between the cacheStorage and just normal old browser cache?
    Can I store sensitive user data in the cacheStorage?