15 Matching Annotations
  1. Apr 2021
  2. Feb 2021
    1. try { const value = await localforage.getItem('somekey'); // This code runs once the value has been loaded // from the offline store. console.log(value); } catch (err) { // This code runs if there were any errors. console.log(err); }

      This looks like the best approach for me. async/await

    1. return new Promise((resolve, reject) =>

      Notice that functions that you want to call (which you will prepend with "await"), must be structured to ALWAYS return a Promise as has been done here.

    2. Nicely explains how to make asynchronous calls to API/services. Async/Await

    3. try/catch block to be able to catch the error


      The final result of they try catch block it that the code that follows below is almost exactly like how I usually code synchronously. It's so much easier to read.

    4. await without async is bad

      The are ALWAYS used together.

    5. Callback Hell

      This is so easy to fall into. I've done it a few times. Always try to avoid this.

    6. Promises

      Never forget this. It's very important.

    1. <pre>  My Bonnie lies over the ocean.   My Bonnie lies over the sea.  My Bonnie lies over the ocean.  Oh, bring back my Bonnie to me.</pre>

      This looks really useful.

    1. Getting started

      This is my first annotation using this extension. It explains how to get started.