Aucune description

GlobalUserStorageTool.js 568B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Created by zack on 2018/1/25.
  3. */
  4. const GlobalUserStorageTool = {
  5. load: (key, response, error) => {
  6. global.storage.load({
  7. key: key,
  8. autoSync: true,
  9. syncInBackground: true,
  10. }).then(ret => {
  11. response(ret)
  12. }).catch((err) => {
  13. error(err)
  14. })
  15. },
  16. save:(key, obj) => {
  17. global.storage.save({
  18. key: key,
  19. data: obj
  20. })
  21. },
  22. remove: (key) => {
  23. global.storage.remove({
  24. key: key
  25. })
  26. }
  27. }
  28. const UserStorageKey = {
  29. UserInfo: 'UserInfo',
  30. AccountAndPassword: 'AccountAndPassword'
  31. }
  32. export {
  33. GlobalUserStorageTool,
  34. UserStorageKey
  35. }