@etsoo/shared 1.1.86 → 1.1.87

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.
@@ -57,7 +57,7 @@ export declare namespace DomUtils {
57
57
  * @param suggestedName Suggested file name
58
58
  * @param autoDetect Auto detect, false will use link click way
59
59
  */
60
- function downloadFile(data: ReadableStream | Blob, suggestedName?: string, autoDetect?: boolean): Promise<void>;
60
+ function downloadFile(data: ReadableStream | Blob, suggestedName?: string, autoDetect?: boolean): Promise<boolean>;
61
61
  /**
62
62
  * File to data URL
63
63
  * @param file File
@@ -252,6 +252,7 @@ var DomUtils;
252
252
  else {
253
253
  yield data.pipeTo(stream);
254
254
  }
255
+ return true;
255
256
  }
256
257
  else {
257
258
  const url = window.URL.createObjectURL(data instanceof Blob
@@ -266,11 +267,13 @@ var DomUtils;
266
267
  a.click();
267
268
  a.remove();
268
269
  window.URL.revokeObjectURL(url);
270
+ return true;
269
271
  }
270
272
  }
271
273
  catch (e) {
272
274
  console.log(e);
273
275
  }
276
+ return false;
274
277
  });
275
278
  }
276
279
  DomUtils.downloadFile = downloadFile;
@@ -57,7 +57,7 @@ export declare namespace DomUtils {
57
57
  * @param suggestedName Suggested file name
58
58
  * @param autoDetect Auto detect, false will use link click way
59
59
  */
60
- function downloadFile(data: ReadableStream | Blob, suggestedName?: string, autoDetect?: boolean): Promise<void>;
60
+ function downloadFile(data: ReadableStream | Blob, suggestedName?: string, autoDetect?: boolean): Promise<boolean>;
61
61
  /**
62
62
  * File to data URL
63
63
  * @param file File
@@ -249,6 +249,7 @@ export var DomUtils;
249
249
  else {
250
250
  yield data.pipeTo(stream);
251
251
  }
252
+ return true;
252
253
  }
253
254
  else {
254
255
  const url = window.URL.createObjectURL(data instanceof Blob
@@ -263,11 +264,13 @@ export var DomUtils;
263
264
  a.click();
264
265
  a.remove();
265
266
  window.URL.revokeObjectURL(url);
267
+ return true;
266
268
  }
267
269
  }
268
270
  catch (e) {
269
271
  console.log(e);
270
272
  }
273
+ return false;
271
274
  });
272
275
  }
273
276
  DomUtils.downloadFile = downloadFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/shared",
3
- "version": "1.1.86",
3
+ "version": "1.1.87",
4
4
  "description": "TypeScript shared utilities and functions",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
package/src/DomUtils.ts CHANGED
@@ -295,6 +295,8 @@ export namespace DomUtils {
295
295
  } else {
296
296
  await data.pipeTo(stream);
297
297
  }
298
+
299
+ return true;
298
300
  } else {
299
301
  const url = window.URL.createObjectURL(
300
302
  data instanceof Blob
@@ -312,10 +314,14 @@ export namespace DomUtils {
312
314
  a.remove();
313
315
 
314
316
  window.URL.revokeObjectURL(url);
317
+
318
+ return true;
315
319
  }
316
320
  } catch (e) {
317
321
  console.log(e);
318
322
  }
323
+
324
+ return false;
319
325
  }
320
326
 
321
327
  /**