getItem.js 536 B

123456789101112
  1. import { executeCallback, normaliseKey } from 'localforage-driver-commons';
  2. export function getItem(key$, callback) {
  3. key$ = normaliseKey(key$);
  4. const promise = this.ready().then(() => {
  5. const result = this._dbInfo.mStore.get(key$);
  6. // Deserialise if the result is not null or undefined
  7. return result == null ? null : this._dbInfo.serializer.deserialize(result); //tslint:disable-line:triple-equals
  8. });
  9. executeCallback(promise, callback);
  10. return promise;
  11. }
  12. //# sourceMappingURL=getItem.js.map