123456789101112131415161718192021 |
- import getStorage from './getStorage';
- export default function createWebStorage(type) {
- var storage = getStorage(type);
- return {
- getItem: function getItem(key) {
- return new Promise(function (resolve, reject) {
- resolve(storage.getItem(key));
- });
- },
- setItem: function setItem(key, item) {
- return new Promise(function (resolve, reject) {
- resolve(storage.setItem(key, item));
- });
- },
- removeItem: function removeItem(key) {
- return new Promise(function (resolve, reject) {
- resolve(storage.removeItem(key));
- });
- }
- };
- }
|