Offline / Online Sync Data – Typescript / Ionic 3

This is my way;

How is the Lifecycle :

  1. create today date
  2. Return a new Promise
    1. Get day value from Storage
    2. and set as storedDay local variable
    3. if today and storedDay equal
      1. return Data from Storage
    4. else
      1. Create Http Request
        1. if success
          1. .mapped the responses as json type
          2. Save the Actually Date in to the DB
          3. Save the Data in tho DB
          4. return Data from Api
        2. else
          1. return error message



and we must first bethis provider/component inserted in to the “app.module.ts”.

and we are ready;


Leave a Reply

Your email address will not be published.