A helper library for chrome.storage API.
(async () => {
const cs = new ChromeStorage()
await cs.getAll()
/* { } */
await cs.set('aa/bb/cc', 'coco')
await cs.getAll()
/*
{ aa : { bb : { cc : "coco" } } }
*/
await cs.get('aa/bb/cc')
/*
"coco"
*/
await cs.push('aa/users', 'human')
await cs.push('aa/users', { aa : { bb : 'exam' }})
await cs.getAll()
/*
{
aa : {
bb : { cc : "coco" }
users : [
"human",
{ aa : { bb : "exam' } }
]
}
}
*/
await cs.remove('aa/users')
/*
{ aa : { bb : { cc : "coco" } } }
*/
await cs.push('aa/bb', 1)
/*
err : must be an array type. (key data: { cc : "coco" })
*/
await cs.push('aa/bb/cc', 1)
/*
err : must be an array type. (key data: "coco")
*/
await cs.clear()
/* { } */
})()
getAll(): object
cs.getAll()
get(key: string): any
cs.get('aa/bb/cc')
set(key: string, value: any): void
cs.set('aa/bb/cc', 'coco')
push(key: string, value: any): void
cs.push('aa/users', 'human')
remove(key: string): void
cs.remove('aa/users')
clear(): void
cs.clear()