function writeFile (filename, contents, options, callback) { // Options do not matter in browser setup if (typeof options === 'function') { callback = options; } localforage.setItem(filename, contents, function () { return callback(); }); }
function rename (filename, newFilename, callback) { localforage.getItem(filename, function (err, value) { if (value === null) { localforage.removeItem(newFilename, function () { return callback(); }); } else { localforage.setItem(newFilename, value, function () { localforage.removeItem(filename, function () { return callback(); }); }); } }); }
async set (key, value) { this.cache[key] = value if (this.storage) { try { await this.storage.setItem(key, value) } catch (e) { console.warn(e) console.warn('Could not save to database') } } }
static async willSetAccessToken(value) { return localForage.setItem(persist.ACCESS_TOKEN_KEY, value).catch(err => err) }
function appendFile (filename, toAppend, options, callback) { // Options do not matter in browser setup if (typeof options === 'function') { callback = options; } localforage.getItem(filename, function (err, contents) { contents = contents || ''; contents += toAppend; localforage.setItem(filename, contents, function () { return callback(); }); }); }
static async willSetSessionToken(value) { return localForage.setItem(persist.SESSION_TOKEN_KEY, value).catch(err => err) }
function appendFile (filename, toAppend, options, callback) { // Options do not matter in browser setup if (typeof options === 'function') { callback = options; } localforage.getItem(filename, function (err, contents) { contents = contents || ''; contents += toAppend; localforage.setItem(filename, contents, function () { return callback(); }); }); }
function rename (filename, newFilename, callback) { localforage.getItem(filename, function (err, value) { if (value === null) { localforage.removeItem(newFilename, function () { return callback(); }); } else { localforage.setItem(newFilename, value, function () { localforage.removeItem(filename, function () { return callback(); }); }); } }); }
function writeFile (filename, contents, options, callback) { // Options do not matter in browser setup if (typeof options === 'function') { callback = options; } localforage.setItem(filename, contents, function () { return callback(); }); }