Guest User

Untitled

a guest
Feb 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public get(key: string) {
  2. localforage.getItem(key).then(function (value) {
  3.  
  4. console.log(value); // exibe o value normalmente, ex.: {nome: 'Joao', idade: '20'}
  5. return value;
  6.  
  7. }).catch(function (err) {
  8. console.log(err);
  9. });
  10. }
  11.  
  12. recuperarItem() {
  13. var object = this.storage.get('pessoa1');
  14.  
  15. console.log(object); // undefined
  16. }
  17.  
  18. public get(key: string) {
  19. return localforage.getItem(key).catch(function (err) {
  20. console.log(err);
  21. });
  22. }
  23.  
  24. recuperarItem() {
  25. this.storage.get().then(function (value) {
  26. console.log(value);
  27. })
  28. }
  29.  
  30. public get(key: string) {
  31. return localforage.getItem(key).catch(function (err) {
  32. console.log(err);
  33. });
  34. }
  35.  
  36. async recuperarItem() {
  37. var object = await this.storage.get();
  38. console.log(value);
  39. }
  40.  
  41. ...
  42. localforage.getItem(key).then((value) => {
  43. ...
Add Comment
Please, Sign In to add comment