title: How to use localForage synchronously
body: <p>I have a Cordova mobile app that stores offline data in localStorage. Recently users started getting QUOTA_EXCEEDED_ERR error because localStorage has 5MB limit. I decided to use "localForage" framework, but I noticed that it works asynchronously. Since I don't want to rewrite all my complex app wrapping into callback functions I wanted to know if there is some way to use "localForage" synchronously (wait till getItem function returns value).</p>
  
  <p>Here is a code example what I am trying to do:</p>
  
  <pre><code>localforage.setItem('testKey', 'testValue', function() {
    var value = getValue('testKey');
  
    console.log(value); // here I get undefined, but I want to get a value
  });
  
  function getValue(key) { // I want this function to return value
    var result;
      localforage.getItem(key, function(value) {
      result = value;
    });
  
    return result;
  }
  </code></pre>
  
  <p>I want getValue() to return a value without changing any other code</p>