UI for Zipcoin Blue

12345678910111213141516171819202122232425262728293031323334353637
  1. requirejs.config({
  2. paths: {
  3. localforage: './../dist/localforage'
  4. }
  5. });
  6. define(['localforage'], function(lf) {
  7. lf.ready(function() {
  8. var key = 'STORE_KEY';
  9. var value = 'What we save offline';
  10. var UNKNOWN_KEY = 'unknown_key';
  11. lf.setItem(key, value, function() {
  12. console.log('SAVING', value);
  13. lf.getItem(key, function(readValue) {
  14. console.log('READING', readValue);
  15. });
  16. });
  17. // Promises code.
  18. lf.setItem('promise', 'ring', function() {
  19. lf.getItem('promise').then(function(readValue) {
  20. console.log('YOU PROMISED!', readValue);
  21. });
  22. });
  23. // Since this key hasn't been set yet, we'll get a null value
  24. lf.getItem(UNKNOWN_KEY, function(readValue) {
  25. console.log('FAILED READING', UNKNOWN_KEY, readValue);
  26. });
  27. });
  28. lf.ready().then(function() {
  29. console.log("You can use ready from Promises too");
  30. })
  31. });