@zyzgroup/core-web 0.0.89 → 0.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zyzgroup_core_web.iife.js +1 -1
- package/dist/zyzgroup_core_web.iife.js.map +1 -1
- package/dist/zyzgroup_core_web.js +5 -3
- package/dist/zyzgroup_core_web.js.map +1 -1
- package/dist/zyzgroup_core_web.umd.cjs +1 -1
- package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/types/file.d.ts +6 -2
- package/types/file.d.ts.map +1 -1
|
@@ -2981,9 +2981,11 @@ class Rc {
|
|
|
2981
2981
|
end = 0;
|
|
2982
2982
|
timer;
|
|
2983
2983
|
timeData = [0, 0, 0, 0, 0, 0];
|
|
2984
|
-
|
|
2984
|
+
onExist;
|
|
2985
|
+
onStart;
|
|
2985
2986
|
onProgress;
|
|
2986
2987
|
onComplete;
|
|
2988
|
+
onTime;
|
|
2987
2989
|
constructor(t) {
|
|
2988
2990
|
this.axios = new ih({
|
|
2989
2991
|
baseURL: t.baseURL,
|
|
@@ -2991,13 +2993,13 @@ class Rc {
|
|
|
2991
2993
|
request: (e) => e,
|
|
2992
2994
|
response: (e) => (e.config.url == this.uploadURL && e.status == 200 && (this.onProgress?.(this.currentChunk++, this.chunks), this.end == this.file.size ? (this.isUploading = !1, this.stopTimeCount(), this.onComplete?.()) : this.isUploading && this.uploadChunk()), e)
|
|
2993
2995
|
}
|
|
2994
|
-
}), this.checkURL = t.checkURL, this.uploadURL = t.uploadURL, this.file = t.file, this.chunkSize = t.chunkSize || 1 * 1024 * 1024, this.chunks = Math.ceil(this.file.size / this.chunkSize), this.
|
|
2996
|
+
}), this.checkURL = t.checkURL, this.uploadURL = t.uploadURL, this.file = t.file, this.chunkSize = t.chunkSize || 1 * 1024 * 1024, this.chunks = Math.ceil(this.file.size / this.chunkSize), this.onExist = t.onExist, this.onStart = t.onStart, this.onProgress = t.onProgress, this.onComplete = t.onComplete, this.onTime = t.onTime;
|
|
2995
2997
|
}
|
|
2996
2998
|
async start() {
|
|
2997
2999
|
this.fileHash || (this.fileHash = await hh(this.file, this.chunkSize)), (await this.axios.post(this.checkURL, {
|
|
2998
3000
|
fileName: this.file.name,
|
|
2999
3001
|
fileHash: this.fileHash
|
|
3000
|
-
})).isExist ? (this.isUploading = !1, this.
|
|
3002
|
+
})).isExist ? (this.isUploading = !1, this.onExist?.()) : this.isUploading || (this.onStart?.(), this.startTimeCount(), await this.uploadChunk());
|
|
3001
3003
|
}
|
|
3002
3004
|
pause() {
|
|
3003
3005
|
this.isUploading && (this.isUploading = !1, this.stopTimeCount());
|