mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 23:16:49 +00:00
优化重试请求逻辑
This commit is contained in:
19
lib/utils.js
19
lib/utils.js
@@ -80,3 +80,22 @@ export function isObject(item) {
|
||||
export function isIterable(obj) {
|
||||
return obj != null && typeof obj[Symbol.iterator] === 'function'
|
||||
}
|
||||
|
||||
export function deepClone(obj) {
|
||||
const newObj = Array.isArray(obj) ? [] : {}
|
||||
if (obj && typeof obj === 'object') {
|
||||
for (const key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
newObj[key] = (obj && typeof obj[key] === 'object') ? deepClone(obj[key]) : obj[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
return newObj
|
||||
}
|
||||
|
||||
/**
|
||||
* 延时
|
||||
* @param {*} ms
|
||||
* @returns
|
||||
*/
|
||||
export const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
|
||||
Reference in New Issue
Block a user