Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storage vs LocalStorage in Ionic2

Hello everyone,

Does anyone know what is the difference between Storage and LocalStorage of Ionic2 ? I am not very clear when reading it. Please kindly explain me.

Thanks in advance.

like image 935
KyiLis Avatar asked Mar 16 '17 03:03

KyiLis


1 Answers

There is a nice short description at the Ionic documentation

Basically localStorage is a browser owned key/value system. You can store up to 5Mb depending on the platform. However the OS you are running your app under can decide to delete its content if your app is on the background and OS needs memory.

The Storage plugin will try to use permanent storage such SQLite. Therefore your data lives as long as your app is installed.

So details that need to be persisted such as first launch flag or authentication token and so on, need to go under Storage, where you can decide to store some recurrent data you get from the server at localStorage..

like image 166
Mehdi Avatar answered Oct 03 '22 16:10

Mehdi