src/modules/storage.js
function (key, callbackId) {
    const sender = this.sender
    if (!supportLocalStorage) {
      return callNotSupportFail(sender, callbackId)
    }
    if (!key) {
      sender.performCallback(callbackId, {
        result: FAILED,
        data: INVALID_PARAM
      })
      return
    }
    try {
      const val = localStorage.getItem(key)
      sender.performCallback(callbackId, {
        result: val ? SUCCESS : FAILED,
        data: val || UNDEFINED
      })
    }
    catch (e) {
      // accept any exception thrown during a storage attempt as a quota error
      callFail(sender, callbackId)
    }
  }
function (key, callbackId) {
    const sender = this.sender
    if (!supportLocalStorage) {
      return callNotSupportFail(sender, callbackId)
    }
    if (!key) {
      sender.performCallback(callbackId, {
        result: FAILED,
        data: INVALID_PARAM
      })
      return
    }
    try {
      const val = localStorage.getItem(key)
      sender.performCallback(callbackId, {
        result: val ? SUCCESS : FAILED,
        data: val || UNDEFINED
      })
    }
    catch (e) {
      // accept any exception thrown during a storage attempt as a quota error
      callFail(sender, callbackId)
    }
  }
function ( key , callbackId ) { const sender = this . sender if ( ! supportLocalStorage ) { return callNotSupportFail ( sender , callbackId ) } if ( ! key ) { sender . performCallback ( callbackId , { result : FAILED , data : INVALID_PARAM } ) return } try { const val = localStorage . getItem ( key ) sender . performCallback ( callbackId , { result : val ? SUCCESS : FAILED , data : val || UNDEFINED } ) } catch ( e ) { // accept any exception thrown during a storage attempt as a quota error callFail ( sender , callbackId ) } }
When passed a key name, will return that key's value.
@param {string} key
@param {function} callbackId
When passed a key name will return that key s value .