@basthon/kernel-base 0.40.12 → 0.40.16
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/lib/kernel.d.ts +2 -2
- package/lib/kernel.js +7 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/lib/kernel.d.ts
CHANGED
|
@@ -63,10 +63,10 @@ export declare class KernelBase {
|
|
|
63
63
|
*/
|
|
64
64
|
basthonRoot(absolute?: boolean): string;
|
|
65
65
|
/**
|
|
66
|
-
* Downloading data (bytes array) as filename
|
|
66
|
+
* Downloading data (bytes array or data URL) as filename
|
|
67
67
|
* (opening browser dialog).
|
|
68
68
|
*/
|
|
69
|
-
download(data: Uint8Array, filename: string): void;
|
|
69
|
+
download(data: Uint8Array | string, filename: string): void;
|
|
70
70
|
/**
|
|
71
71
|
* Dynamically load a script asynchronously.
|
|
72
72
|
*/
|
package/lib/kernel.js
CHANGED
|
@@ -131,14 +131,17 @@ export class KernelBase {
|
|
|
131
131
|
return url;
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
|
-
* Downloading data (bytes array) as filename
|
|
134
|
+
* Downloading data (bytes array or data URL) as filename
|
|
135
135
|
* (opening browser dialog).
|
|
136
136
|
*/
|
|
137
137
|
download(data, filename) {
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
if (!(typeof data === 'string' || data instanceof String)) {
|
|
139
|
+
const blob = new Blob([data], { type: "application/octet-stream" });
|
|
140
|
+
data = window.URL.createObjectURL(blob);
|
|
141
|
+
}
|
|
142
|
+
const anchor = document.createElement("a");
|
|
140
143
|
anchor.download = filename;
|
|
141
|
-
anchor.href =
|
|
144
|
+
anchor.href = data;
|
|
142
145
|
anchor.target = "_blank";
|
|
143
146
|
anchor.style.display = "none"; // just to be safe!
|
|
144
147
|
document.body.appendChild(anchor);
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.40.
|
|
1
|
+
export declare const VERSION = "0.40.16";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.40.
|
|
1
|
+
export const VERSION = "0.40.16";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basthon/kernel-base",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.16",
|
|
4
4
|
"description": "Basthon - Base Kernel",
|
|
5
5
|
"homepage": "https://basthon.fr",
|
|
6
6
|
"bugs": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e57395f43c0d943bc4807f201de929ec7f0f44e5"
|
|
40
40
|
}
|