StorageController.weapp.js 470 B

12345678910111213141516171819202122
  1. var StorageController = {
  2. async: 0,
  3. getItem: function (path) {
  4. return wx.getStorageSync(path);
  5. },
  6. setItem: function (path, value) {
  7. try {
  8. wx.setStorageSync(path, value);
  9. } catch (e) {}
  10. },
  11. removeItem: function (path) {
  12. wx.removeStorageSync(path);
  13. },
  14. getAllKeys: function () {
  15. var res = wx.getStorageInfoSync();
  16. return res.keys;
  17. },
  18. clear: function () {
  19. wx.clearStorageSync();
  20. }
  21. };
  22. module.exports = StorageController;