How to use the getItem function from localforage

Find comprehensive JavaScript localforage.getItem code examples handpicked from public code repositorys.

63
64
65
66
67
68
69
70
71
72
    return json;
}

async useStorage(storageId){
    this.#storageId = null;
    const data = await localforage.getItem(storageId);
    if (data) {
        for (let k in data)
            this.set(k, data[k]);
    }
fork icon0
star icon3
watch icon0

3
4
5
6
7
8
9
10
11
12
13
async function oldGetUserConfig(siteid) {
  let userConfig = {};
  try {
    userConfig =
      JSON.parse(
        JSON.parse(await localforage.getItem("persist:state")).userConfig
      ) || {};
  } catch (e) {}


  if (Object.keys(userConfig).length == 0) {
fork icon0
star icon0
watch icon1

+ 26 other calls in file

3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
, storeName: 'nedbdata'
});




function exists (filename, callback) {
  localforage.getItem(filename, function (err, value) {
    if (value !== null) {   // Even if value is undefined, localforage returns null
      return callback(true);
    } else {
      return callback(false);
fork icon0
star icon0
watch icon1

+ 103 other calls in file

269
270
271
272
273
274
275
276
277
278
        : (input === null || input === void 0 ? void 0 : input.params)
            ? this.hash(JSON.stringify(Object.values(input.params)))
            : ""}${this.hash(JSON.stringify(input || {}))}`;
let localData = null;
try {
    data = yield localforage.getItem(localKey);
}
catch (_g) {
    console.log("No Local data found");
}
fork icon0
star icon0
watch icon1