LevelDB & Crypto

Q&A: IndexedDB vs. LocalStorage

James Halliday

James Halliday

Substack
LevelDB & Crypto

Check out a free preview of the full LevelDB & Crypto course

The "Q&A: IndexedDB vs. LocalStorage" Lesson is part of the full, LevelDB & Crypto course featured in this preview video. Here's what you'd learn in this lesson:

James takes questions from the students about IndexedDB and LocalStorage, browser support, and more.

Preview
Close

Transcript from the "Q&A: IndexedDB vs. LocalStorage" Lesson

[00:00:00]
>> Right, so Justin asks why local storage exists, [LAUGH] I guess. If there's IndexedDB and local storage, why is there two of those? Well, local storage pretty sure came beforeIndexedDB. But unfortunately, local storage has some fatal flaws, like it's synchronous. And so doing heavy lifting, doing data intensive things is not gonna work very well.

[00:00:25]
It's gonna block the rendering loop all kinds of problems. So I would say don't even learn about local storage cuz it's just kind of a bad idea. [LAUGH] You can use IndexedDB with these nice wrappers and it's just as easy, but it's a better foundation. Okay, so the other question is, what does the browser support look like?

[00:00:53]
So I don't recall exactly what the browser support is like for the LevelDB browserify stream, but I'd imagine that it's gonna be really similar to IndexedDB itself. So you can pretty safely use it on mobile and you can pretty, IE11 has it. I think 10 might even have it.

[00:01:09]
>> 10 has it, but-
>> Yeah, it kind of works in IE10, right? It works well enough in 11 or Edge or whatever they call it now. You always have to watch out for Safari, which is the IE6 of our day, but it should work reasonably well in most browsers.

[00:01:30]
How does the offline and the online sync work? You use it offline and you wanna sync it on the server site, database site.
>> Yes, so if you wanna implement something like syncing, there's more pieces that you're gonna need to implement that well, which I'll be covering after lunch.

[00:01:51]
But generally speaking, you need something like an append only log to do syncing well. And we're gonna be doing some stuff with crypto as well to do that securely using this idea called Merkle degs, signed Merkel degs. Yes, syncing is a little bit more involved, but we'll get to that.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now