style: code lint
This commit is contained in:
parent
0abc223283
commit
0ad1fd3c37
|
@ -19,7 +19,7 @@ const config = {
|
||||||
offsetTernaryExpressions: true //三元表达式缩进
|
offsetTernaryExpressions: true //三元表达式缩进
|
||||||
}],
|
}],
|
||||||
quotes: ["error", "double"], // 引号
|
quotes: ["error", "double"], // 引号
|
||||||
"object-shorthand": ["error", "consistent"], // 对象字面量简写语法
|
"object-shorthand": ["off", "consistent"], // 对象字面量简写语法
|
||||||
|
|
||||||
"no-unused-vars": "off", // 禁止未使用过的变量。已禁用,使用typescript检查
|
"no-unused-vars": "off", // 禁止未使用过的变量。已禁用,使用typescript检查
|
||||||
"no-undef": "off", // 禁止未声明的变量。已禁用,使用typescript检查
|
"no-undef": "off", // 禁止未声明的变量。已禁用,使用typescript检查
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class SHA256Calculator {
|
||||||
} else if (data instanceof Uint8Array) {
|
} else if (data instanceof Uint8Array) {
|
||||||
newData = data
|
newData = data
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Data must be a string or ArrayBuffer")
|
throw new Error("Data must be a string or Uint8Array")
|
||||||
}
|
}
|
||||||
const combinedData = new Uint8Array(this.digestBuffer.length + newData.length)
|
const combinedData = new Uint8Array(this.digestBuffer.length + newData.length)
|
||||||
combinedData.set(this.digestBuffer, 0)
|
combinedData.set(this.digestBuffer, 0)
|
||||||
|
|
|
@ -36,7 +36,7 @@ interface UploaderWorkerConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 上传任务 */
|
/** 上传任务 */
|
||||||
interface UploadTask {
|
interface UploadTask {
|
||||||
/** 任务ID */
|
/** 任务ID */
|
||||||
id: number
|
id: number
|
||||||
/** 文件 */
|
/** 文件 */
|
||||||
|
|
|
@ -219,7 +219,7 @@ function uploadChunkTask(taskId: any, { index, hash, blob }: FileChunk, onProgre
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkMergeStatus(taskId) {
|
function checkMergeStatus(taskId: number) {
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
// 轮询检查合并状态
|
// 轮询检查合并状态
|
||||||
const f = async () => {
|
const f = async () => {
|
||||||
|
@ -271,6 +271,7 @@ async function postData<T = any>(url: string, data: unknown) {
|
||||||
function retry(f: Function, count: number) {
|
function retry(f: Function, count: number) {
|
||||||
let retryCount = 0
|
let retryCount = 0
|
||||||
return async (...args: any) => {
|
return async (...args: any) => {
|
||||||
|
// eslint-disable-next-line no-constant-condition
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
retryCount += 1
|
retryCount += 1
|
||||||
|
|
Loading…
Reference in New Issue