Best practice to use updated offline info


#1

Hi,

I want to implement a offline logic into my app and I am no sure what would be the best way to do it.

My app on-device-ready obtain updated content from backend api and then two options:

  1. Store info into ionic storage (sqllite) with key-value way

  2. Store it into a defined injectable service (app module) with in variables in a singleton design pattern way.

The app is a sidemenu app and access to different stored infos on each page. (From Ionic storage or singleton)

Which would be the correct way to implement this requisites?

Thanks


#2

Pretty simple. If you want the data to persist even if the close the app and/or restart their phone, you need ionic storage. If you don’t want to do that, just use a singleton.


#3

Thanks for your time.

I understand the implications at persistence level but my question is about performance or ‘best practices.