code: function setItem(key, value, callback) {
  	        var self = this;
  
  	        // Cast the key to a string, as that's all we can set as a key.
  	        if (typeof key !== 'string') {
  	            globalObject.console.warn(key + ' used as a key, but it is not a string.');
  	            key = String(key);
  	        }
  
  	        var promise = self.ready().then(function () {
  	            // Convert undefined values to null.
  	            // https://github.com/mozilla/localForage/pull/42
  	            if (value === undefined) {
  	                value = null;
  	            }
  
  	            // Save the original value to pass to the callback.
  	            var originalValue = value;
  
  	            return new Promise(function (resolve, reject) {
  	                var dbInfo = self._dbInfo;
  	                dbInfo.serializer.serialize(value, function (value, error) {
  	                    if (error) {
  	                        reject(error);
  	                    } else {
  	                        try {
  	                            localStorage.setItem(dbInfo.keyPrefix + key, value);
  	                            resolve(originalValue);
  	                        } catch (e) {
  	                            // localStorage capacity exceeded.
  	                            // TODO: Make this a specific error/event.
  	                            if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
  	                                reject(e);
  	                            }
  	                            reject(e);
  	                        }
  	                    }
  	                });
  	            });
  	        });
  
  	        executeCallback(promise, callback);
  	        return promise;
  	    }
docs: Set a key's value and run an optional callback once the value is set. Unlike Gaia's implementation, the callback function is passed the value, in case you want to operate on that value only after you're sure it saved, or something like that.