@olenbetong/appframe-core 1.3.1 → 1.3.4
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/esm/af.common.js +7 -7
- package/dist/esm/af.common.legacy.js +698 -0
- package/dist/esm/af.common.legacy.min.js +48 -0
- package/dist/esm/af.common.legacy.min.js.map +7 -0
- package/dist/esm/af.common.min.js +2 -2
- package/dist/esm/af.common.min.js.map +3 -3
- package/dist/iife/af.common.js +9 -9
- package/dist/iife/af.common.legacy.js +722 -0
- package/dist/iife/af.common.legacy.min.js +48 -0
- package/dist/iife/af.common.legacy.min.js.map +7 -0
- package/dist/iife/af.common.min.js +3 -3
- package/dist/iife/af.common.min.js.map +3 -3
- package/es/downloadRequest.d.ts +2 -2
- package/es/downloadRequest.js +3 -3
- package/es/index.js +1 -1
- package/package.json +6 -2
- package/src/downloadRequest.ts +4 -4
package/dist/esm/af.common.js
CHANGED
|
@@ -62,7 +62,7 @@ function downloadBlob(blob, fileName) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// src/downloadRequest.ts
|
|
65
|
-
async function downloadRequest(request, { fileName,
|
|
65
|
+
async function downloadRequest(request, { fileName, signal, onProgress }) {
|
|
66
66
|
function reportProgress(progress) {
|
|
67
67
|
if (typeof onProgress === "function") {
|
|
68
68
|
onProgress({ ...progress });
|
|
@@ -79,21 +79,21 @@ async function downloadRequest(request, { fileName, controller, onProgress }) {
|
|
|
79
79
|
throw new Error(data.error);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
throw new Error(response.status
|
|
82
|
+
throw new Error(`${response.status} ${response.statusText}`);
|
|
83
83
|
}
|
|
84
84
|
try {
|
|
85
85
|
const reader = response.body.getReader();
|
|
86
86
|
const stream = new ReadableStream({
|
|
87
|
-
start: function(
|
|
87
|
+
start: function(controller) {
|
|
88
88
|
function pump() {
|
|
89
89
|
return reader.read().then(function(read) {
|
|
90
90
|
if (read.done) {
|
|
91
|
-
|
|
91
|
+
controller.close();
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
bytesReceived += read.value.length;
|
|
95
95
|
reportProgress({ bytesReceived, status: "downloading" });
|
|
96
|
-
|
|
96
|
+
controller.enqueue(read.value);
|
|
97
97
|
return pump();
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -109,7 +109,7 @@ async function downloadRequest(request, { fileName, controller, onProgress }) {
|
|
|
109
109
|
await downloadBlob(blob, fileName);
|
|
110
110
|
reportProgress({ bytesReceived, status: "completed" });
|
|
111
111
|
} catch (err) {
|
|
112
|
-
if (
|
|
112
|
+
if (signal?.aborted) {
|
|
113
113
|
reportProgress({ status: "cancelled" });
|
|
114
114
|
} else {
|
|
115
115
|
reportProgress({ error: err.message, status: "error" });
|
|
@@ -653,7 +653,7 @@ function saveSettings(setting, value, article) {
|
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
// src/index.ts
|
|
656
|
-
var version = "1.3.
|
|
656
|
+
var version = "1.3.4";
|
|
657
657
|
export {
|
|
658
658
|
SessionHandler,
|
|
659
659
|
UserSession,
|