MCPcopy
hub / github.com/localForage/localForage / getItem

Function getItem

test/dummyStorageDriver.js:65–98  ·  view source on GitHub ↗
(key, callback)

Source from the content-addressed store, hash-verified

63 }
64
65 function getItem(key, callback) {
66 var self = this;
67
68 // Cast the key to a string, as that's all we can set as a key.
69 if (typeof key !== 'string') {
70 window.console.warn(
71 key + ' used as a key, but it is not a string.'
72 );
73 key = String(key);
74 }
75
76 var promise = new Promise(function(resolve, reject) {
77 self
78 .ready()
79 .then(function() {
80 try {
81 var db = self._dbInfo.db;
82 var result = db[key];
83
84 if (result) {
85 result = _deserialize(result);
86 }
87
88 resolve(result);
89 } catch (e) {
90 reject(e);
91 }
92 })
93 .catch(reject);
94 });
95
96 executeCallback(promise, callback);
97 return promise;
98 }
99
100 function iterate(callback) {
101 var self = this;

Callers

nothing calls this directly

Calls 3

_deserializeFunction · 0.85
executeCallbackFunction · 0.70
readyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…