emacroh5lib 1.0.27 → 1.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emacroh5lib",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "EMacro前端组件库",
5
5
  "main": "dist/emacroh5lib.min.js",
6
6
  "scripts": {
@@ -93,6 +93,7 @@
93
93
  "lay-excel": "^1.7.6",
94
94
  "query-string": "^7.0.1",
95
95
  "register-service-worker": "^1.7.2",
96
+ "sync-task-queue": "^1.0.4",
96
97
  "three": "^0.139.2",
97
98
  "types": "file:../../browser-md5-file",
98
99
  "typings": "^2.1.1",
@@ -2,6 +2,8 @@
2
2
  import * as XLSX from "xlsx";
3
3
  import BMF from 'browser-md5-file';
4
4
 
5
+ import createTaskQueue from 'sync-task-queue'
6
+
5
7
  export namespace EMacro {
6
8
 
7
9
  export const version = "1.0"
@@ -71,6 +73,8 @@ export namespace EMacro {
71
73
 
72
74
  File.getFileMD5(file).then(md5 => {
73
75
 
76
+ const taskQueue = createTaskQueue();
77
+
74
78
  for (let index in fileChunks) {
75
79
  let chunk = fileChunks[Number(index)]
76
80
 
@@ -87,15 +91,12 @@ export namespace EMacro {
87
91
  'md5': md5,
88
92
  'dataType': 'base64' // 数据的类型
89
93
  }
90
- setTimeout(async () => {
91
- await postFunc(data)
92
- }, 10 * Number(index));
94
+
95
+ taskQueue.enqueue(postFunc(data)).then((res) => console.log('文件上传chunkIndex: ', index, res));
93
96
 
94
97
  }).catch((err) => {
95
98
  errFunc({ err: err, file: file.file, chunkIndex: index, fileName: file.name })
96
99
  })
97
-
98
-
99
100
  }
100
101
 
101
102
  }).catch(err => {