Это видео недоступно.
Сожалеем об этом.

IndexedDB Part 1 - Creating and Versioning

Поделиться
HTML-код
  • Опубликовано: 22 фев 2021
  • This is the first video in my series on learning how to use all the IndexedDB features with vanilla JS.
    This video covers how to create and version Databases, how to add and delete stores inside your databases, as well as an overview of the major objects and interfaces that make up IndexedDB.
    Code from video: gist.github.co...
    IndexedDB Playlist: • Simple Introduction to...
    MDN reference for IndexedDB Concepts: developer.mozi...

Комментарии • 57

  • @nisahidayatika231
    @nisahidayatika231 Год назад +3

    Hi, Steve! I just wanna say that I'm so thankful that I found your channel. I find many interesting videos here. Tutorials that aren't popular(I couldn't find many youtuber talk about these topics on RUclips), but important to know (like this one). As a self-learner, your channel really helps me.

  • @BP-kc3dj
    @BP-kc3dj 3 года назад +2

    YOU ARE THE MAN!!!!!!!!! Looking all over the web and found only crappy tutorials with partical code and cryptic guidance until landing here. YOU ROCK MAN!!!! Subbing.

  • @fatihkilic5850
    @fatihkilic5850 3 года назад +5

    Clear and high level teaching. Thank you so much

  • @bryanathallah8513
    @bryanathallah8513 10 месяцев назад +1

    what a great explanation Steve!, from Indonesia 👍👍

  • @stephanpetersen3600
    @stephanpetersen3600 3 года назад +2

    Thanks Steve for deep diving with us! Great theme!

  • @SingleWingAcademy
    @SingleWingAcademy 3 года назад +6

    phenomenal clarity. as always.

  • @omarguzman1112
    @omarguzman1112 2 года назад +1

    Excellent! Clear, thorough and easy to grasp

  • @smartsoil
    @smartsoil Год назад +1

    Absolutely fantastic series Steve!

  • @user-el9gb4dj8h
    @user-el9gb4dj8h 2 года назад

    It is what I have been looking forward to deeply know about something for me.

  • @grbsql
    @grbsql Год назад

    Excelente video. Muchas gracias

  • @JakobPapirov
    @JakobPapirov 2 года назад

    Great video! I really liked the pace, gave me time think while you were explaining.

  • @savimcgee7443
    @savimcgee7443 2 года назад

    I will like and second, "phenomenal clarity. as always"

  • @agent-33
    @agent-33 2 года назад

    Really good explanation and I can read the codes due to zoom ins.

  • @Ahmed-fq3kz
    @Ahmed-fq3kz 7 месяцев назад

    So clear, thanks alot.

  • @mackenzy7121
    @mackenzy7121 3 года назад +1

    Very clear, very good tutorial

  • @rmnkot
    @rmnkot 3 года назад +1

    Interesting and helpful info. Thanks!

  • @user-cd7gi6dh7m
    @user-cd7gi6dh7m 3 года назад +1

    Very helpful!!!Excellent work!

  • @Kurkkulimu
    @Kurkkulimu 2 года назад

    thank you very easy to follow and understand 🙏

  • @DanielBeeke
    @DanielBeeke 3 года назад +1

    Very clear and concise :)

  • @quangpham-qs5oo
    @quangpham-qs5oo Год назад

    valuable content. thanks

  • @blokche_dev
    @blokche_dev 3 года назад +1

    Valuable content, as always. Thanks a lot!

  • @Colstonewall
    @Colstonewall 3 года назад +1

    Love it! Thanks Steve!!

  • @1Malak16
    @1Malak16 3 года назад

    Thanks for this video! Subscribed immidiatelly

  • @sashatv138
    @sashatv138 3 года назад

    Amazing series of videos! Thank you!

  • @diegoandresyepescelis2786
    @diegoandresyepescelis2786 3 года назад +1

    gracias !!! es una excelente explicación!!

  • @ubaidarshad
    @ubaidarshad 3 месяца назад

    comment for more recommendations

  • @MrBullterrier
    @MrBullterrier Год назад +1

    HI, Steve!
    Maybe I'm being dense here, but can you explain why you're encapsulating your code in an IIFE?
    I've looked online and the best I can gather is, that it prevents global scope issues. However doesn't putting it in a const already prevent that?
    I'm loving the tutorial by the way. Cheers!

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Год назад +1

      The goal is always to minimize things in the global scope and reduce the chances of naming collisions. I will often write code in different ways in different videos to show alternate approaches.
      Sometimes I will use modules, sometimes not.
      Sometimes I will wrap all the code in a namespace (const APP = { }) with all the code inside the APP object. this approach will use a DOMContentLoaded listener outside APP that calls an init method inside the object.
      Sometimes I will wrap the initial function inside an IIFE to start things running.
      If you put each function into a const in the global scope then you are missing the initial goals.

    • @MrBullterrier
      @MrBullterrier Год назад

      @@SteveGriffith-Prof3ssorSt3v3
      That's very well explained. I'm usually doing smaller projects by myself, so I'm not very familiar with such techniques.
      Thank you!

  • @niallhoran5363
    @niallhoran5363 Год назад

    great video♥

  • @samueldias89
    @samueldias89 Год назад

    hey steve thanks for the video, i have a question here if i already have created store with some keypath with "Id" and now i want to change the keypath as composite of "Id" & "Name" of the existing store is it possible? if yes then how?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Год назад

      If you want to change the indexes for the database then you have to increment the version and recreate them in the upgrade needed event listener.

    • @samueldias89
      @samueldias89 Год назад

      @@SteveGriffith-Prof3ssorSt3v3 indexes can be added on existing store but can we change existing keypath of the store/table without deleting it?

  • @ofeenee
    @ofeenee 2 года назад

    Thank you so very much for the series. I watched both this and service worker’s, and I cannot be more grateful. I have a question if I may: around the beginning, you did mention how to protect our indexDB with service worker, but I still failed to realize how after watching all the videos… may you please explain?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 года назад +1

      I have another playlist on service workers that explains how that part works.

    • @ofeenee
      @ofeenee 2 года назад

      @@SteveGriffith-Prof3ssorSt3v3 i have already watched all of it. Really amazing. But I couldn’t find where you mentioned that particular info.

  • @paulbeaudet1
    @paulbeaudet1 3 года назад

    Steve, I'm curious if the upgrade event was ever meant for migrations or data initialization? For example, if a property needs to be added to a set of data in a newer version of the application and you want to backfill the property values in older data. I'm trying to gauge if I'm making bad assumptions in trying to do something like that within the upgrade event. I'm getting errors that look like "DOMException: IDBTransaction.objectStore: Transaction is already committing or done." Is that event.target.result db only meant for createObjectStore and indexing? Or maybe my issues might lie in an async quark of the wrapper I'm using (IDB)

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад +1

      upgrade is more about the structure of the database. When you change the structure by adding an index or something else, the change applies to all your existing data.
      After the update is when you would migrate new data to change the contents of the database.

    • @paulbeaudet1
      @paulbeaudet1 3 года назад +1

      @@SteveGriffith-Prof3ssorSt3v3 Thanks for confirming.

  • @randomdamian
    @randomdamian 2 года назад

    Hello,
    thank you for this amazing TUTORIAL! I've seen the Google and Microsoft video and I didn't understand it.
    I need to see the code to understand :D
    Also, if there are some entries in the existing collection and I trigger a new version, will this remove all the entries in the store? Or is the upgrade version just to trigger that function to modify the collections etc?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 года назад +1

      the new version will still have the old data. It is primarily an opportunity to make changes to the structure before working with the database.

  • @Ahmed-fq3kz
    @Ahmed-fq3kz 7 месяцев назад

    What the advantages of making it with vanilla js instead of the library in the prev video

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  7 месяцев назад +2

      The library from the previous exposes a subset of the abilities with a simple localstorage like interface.

  • @CyberTechBits
    @CyberTechBits 11 месяцев назад

    Excellent tutorial. Looking for new team members...Interested in working on a PWA project?

  • @zuberalisavanur1354
    @zuberalisavanur1354 3 года назад

    Hi Steve, i have a question:
    say i have an application with login username and password, and i am creating an store which stores the user data, so say it stores the username for every login, how do i build a store which stores all the usernames in the indexed db and checks for the username before loading the application, thanks in advance

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад

      IndexedDB is only on the client side. It only works for the person who is currently using the computer. You need server-side validation for usernames and passwords.
      Never save usernames and passwords on the client side.

    • @samuelmatheson9655
      @samuelmatheson9655 3 года назад

      @@SteveGriffith-Prof3ssorSt3v3 There are indexed Db wrappers that work on the server, but at that point you may as well have a folder full of text files

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад

      @@samuelmatheson9655 serverside you should be using something else like Mongo or dynamodb or firebase firestorm, etc. This is meant to be a client side way of implementing temporary document style databases.

  • @jimlanpheer5281
    @jimlanpheer5281 3 года назад

    Thanks for this series, i'm going to watch it all. I'm trying to follow your example from square one and my database will not create (and according to my debug statements, that 'init' block never executes. I see that the basics of opening the database are inside a function called 'init'. Is there something 'magical' about the 'init' function or 'init' in general? I don't see that your code calls this function directly, am i right? Obviously, it's meant to initialize but as i follow along, if i can't create the database using your methods, i'm wondering how far i will get. I'm sure that the author is too busy to comment, but if anyone reading this has thoughts, i'd like to hear them. I'm learning! :-)

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад

      The init function is an IIFE - ruclips.net/video/aHb66qj9-64/видео.html
      init just a name. This code can even run without a name there, but it does have to be wrapped in an IIFE
      ( function( ) { } ) ( );
      That last set of parentheses is what makes it run.
      It just runs to call the open method and add the event listeners to the indexedDB object.
      indexeddb is supported pretty much anywhere - caniuse.com/indexeddb - unless you are using a really old browser.

  • @erey2790
    @erey2790 2 года назад

    like

  • @samuelmatheson9655
    @samuelmatheson9655 3 года назад

    documentation writers should be ashamed

  • @NavySturmGewehr
    @NavySturmGewehr 5 месяцев назад

    The lip smacking is terrible. :(

  • @douglasmckinley-sr1507
    @douglasmckinley-sr1507 2 года назад

    Thanks for making this video. Please note that I had to make this change in Index.html to get this running. Running Chrome 104.0.5112.102 I was getting this error.
    Access to script at 'file:///C:/Users/damck/source/IndexedDB%20Tutorial/Lesson01/app.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
    index.html:83 GET file:///C:/Users/damck/source/IndexedDB%20Tutorial/Lesson01/app.js net::ERR_FAILED
    Making this change allowed it to run.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 года назад

      That is a security restriction. IndexedDB and modules are supposed to run only over http, not loaded over file:///