Eslintify all of libtextsecure

This commit is contained in:
Scott Nonnenberg 2018-07-21 14:51:20 -07:00
parent 4b3f9e969a
commit 0774ba2903
36 changed files with 1960 additions and 2128 deletions

View file

@ -1,42 +1,37 @@
'use strict';
/* global window, textsecure, localStorage */
// eslint-disable-next-line func-names
(function() {
/************************************************
/** **********************************************
*** Utilities to store data in local storage ***
************************************************/
*********************************************** */
window.textsecure = window.textsecure || {};
window.textsecure.storage = window.textsecure.storage || {};
// Overrideable storage implementation
window.textsecure.storage.impl = window.textsecure.storage.impl || {
/*****************************
/** ***************************
*** Base Storage Routines ***
*****************************/
put: function(key, value) {
**************************** */
put(key, value) {
if (value === undefined) throw new Error('Tried to store undefined');
localStorage.setItem('' + key, textsecure.utils.jsonThing(value));
localStorage.setItem(`${key}`, textsecure.utils.jsonThing(value));
},
get: function(key, defaultValue) {
var value = localStorage.getItem('' + key);
get(key, defaultValue) {
const value = localStorage.getItem(`${key}`);
if (value === null) return defaultValue;
return JSON.parse(value);
},
remove: function(key) {
localStorage.removeItem('' + key);
remove(key) {
localStorage.removeItem(`${key}`);
},
};
window.textsecure.storage.put = function(key, value) {
return textsecure.storage.impl.put(key, value);
};
window.textsecure.storage.get = function(key, defaultValue) {
return textsecure.storage.impl.get(key, defaultValue);
};
window.textsecure.storage.remove = function(key) {
return textsecure.storage.impl.remove(key);
};
window.textsecure.storage.put = (key, value) =>
textsecure.storage.impl.put(key, value);
window.textsecure.storage.get = (key, defaultValue) =>
textsecure.storage.impl.get(key, defaultValue);
window.textsecure.storage.remove = key => textsecure.storage.impl.remove(key);
})();