2018-04-11 07:28:54 +00:00
|
|
|
class LocalStorageMock {
|
2020-05-22 03:35:25 +00:00
|
|
|
store
|
2018-04-11 07:28:54 +00:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.store = {}
|
|
|
|
}
|
|
|
|
|
|
|
|
clear() {
|
|
|
|
this.store = {}
|
|
|
|
}
|
|
|
|
|
|
|
|
getItem(key) {
|
|
|
|
return this.store[key] || null
|
|
|
|
}
|
|
|
|
|
|
|
|
setItem(key, value) {
|
|
|
|
this.store[key] = value.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
removeItem(key) {
|
|
|
|
delete this.store[key]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
global.localStorage = new LocalStorageMock()
|