You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
630 B

// @flow
import getStorage from './getStorage'
export default function createWebStorage(type: string) {
let storage = getStorage(type)
return {
getItem: (key: string): Promise<string> => {
return new Promise((resolve, reject) => {
resolve(storage.getItem(key))
})
},
setItem: (key: string, item: string): Promise<void> => {
return new Promise((resolve, reject) => {
resolve(storage.setItem(key, item))
})
},
removeItem: (key: string): Promise<void> => {
return new Promise((resolve, reject) => {
resolve(storage.removeItem(key))
})
},
}
}