mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 08:24:50 +03:00
*.jsx -> *.js
This commit is contained in:
parent
0a2b826f71
commit
e88c193334
98 changed files with 341 additions and 340 deletions
46
dev/Storage/Settings.js
Normal file
46
dev/Storage/Settings.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
import window from 'window';
|
||||
import {isUnd, isNormal, isArray, inArray} from 'Common/Utils';
|
||||
|
||||
let SETTINGS = window.__rlah_data() || null;
|
||||
SETTINGS = isNormal(SETTINGS) ? SETTINGS : {};
|
||||
|
||||
let APP_SETTINGS = SETTINGS.System || null;
|
||||
APP_SETTINGS = isNormal(APP_SETTINGS) ? APP_SETTINGS : {};
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {*}
|
||||
*/
|
||||
export function settingsGet(name)
|
||||
{
|
||||
return isUnd(SETTINGS[name]) ? null : SETTINGS[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {*} value
|
||||
*/
|
||||
export function settingsSet(name, value)
|
||||
{
|
||||
SETTINGS[name] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {*}
|
||||
*/
|
||||
export function appSettingsGet(name)
|
||||
{
|
||||
return isUnd(APP_SETTINGS[name]) ? null : APP_SETTINGS[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function capa(name)
|
||||
{
|
||||
const values = settingsGet('Capa');
|
||||
return isArray(values) && isNormal(name) && -1 < inArray(name, values);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue