mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
isArray to native Array.isArray
isUnd(*) to native undefined === *
isFunc to native typeof * === 'function'
isObject to native typeof * === 'object'
microtime() to native Date().getTime();
noop to native ()=>{}
noopFalse to native ()=>false
noopTrue to native ()=>true
boolToAjax to native *?'1':'0'
Underscore.js to native
This commit is contained in:
parent
fa39c7ecba
commit
ea48f5060b
72 changed files with 551 additions and 775 deletions
|
|
@ -51,25 +51,25 @@ const __get = (key) => {
|
|||
const __set = (key, value) => {
|
||||
if (SESS_STORAGE) {
|
||||
SESS_STORAGE.setItem(key, value);
|
||||
} else if (WIN_STORAGE && window.JSON) {
|
||||
} else if (WIN_STORAGE) {
|
||||
let data =
|
||||
WIN_STORAGE.name && '{' === WIN_STORAGE.name.toString().substr(0, 1)
|
||||
? window.JSON.parse(WIN_STORAGE.name.toString())
|
||||
? JSON.parse(WIN_STORAGE.name.toString())
|
||||
: null;
|
||||
data = data || {};
|
||||
data[key] = value;
|
||||
|
||||
WIN_STORAGE.name = window.JSON.stringify(data);
|
||||
WIN_STORAGE.name = JSON.stringify(data);
|
||||
}
|
||||
};
|
||||
|
||||
const timestamp = () => window.Math.round(new window.Date().getTime() / 1000);
|
||||
const timestamp = () => Math.round(new Date().getTime() / 1000);
|
||||
|
||||
const setTimestamp = () => __set(TIME_KEY, timestamp());
|
||||
|
||||
const getTimestamp = () => {
|
||||
const time = __get(TIME_KEY, 0);
|
||||
return time ? window.parseInt(time, 10) || 0 : 0;
|
||||
return time ? parseInt(time, 10) || 0 : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -111,4 +111,4 @@ export function checkTimestamp() {
|
|||
}
|
||||
|
||||
// init section
|
||||
window.setInterval(setTimestamp, 1000 * 60); // 1m
|
||||
setInterval(setTimestamp, 1000 * 60); // 1m
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue