perf[utils]: optimizate variable name

This commit is contained in:
Pan
2019-02-19 10:24:22 +08:00
parent 054e9c4a73
commit 5224a00ddc
4 changed files with 20 additions and 22 deletions

View File

@@ -243,7 +243,7 @@ export function debounce(func, wait, immediate) {
// 据上一次触发时间间隔
const last = +new Date() - timestamp
// 上次被包装函数被调用时间间隔last小于设定时间间隔wait
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last)
} else {
@@ -294,3 +294,9 @@ export function deepClone(source) {
export function uniqueArr(arr) {
return Array.from(new Set(arr))
}
export function createUniqueString() {
const timestamp = +new Date() + ''
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
return (+(randomNum + timestamp)).toString(32)
}