heic-to 1.0.1 → 1.0.3
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/README.md +4 -4
- package/dist/heic-to.d.ts +33 -0
- package/dist/heic-to.js +8 -9
- package/dist/heic-to.min.js +1 -1
- package/package.json +11 -2
- package/src/index.js +10 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heic-to",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Converting HEIF/HEIF image formats to PNG/JPEG in the browser",
|
|
5
5
|
"main": "dist/heic-to.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,8 +11,17 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/hoppergee/heic-to.git"
|
|
13
13
|
},
|
|
14
|
+
"types": "dist/heic-to.d.ts",
|
|
14
15
|
"keywords": [
|
|
15
|
-
"heic",
|
|
16
|
+
"heic",
|
|
17
|
+
"heif",
|
|
18
|
+
"jpeg",
|
|
19
|
+
"jpg",
|
|
20
|
+
"png",
|
|
21
|
+
"conversion",
|
|
22
|
+
"convert",
|
|
23
|
+
"image",
|
|
24
|
+
"decoder"
|
|
16
25
|
],
|
|
17
26
|
"author": "Hopper Gee",
|
|
18
27
|
"license": "LGPL-3.0",
|
package/src/index.js
CHANGED
|
@@ -32,17 +32,16 @@ const decodeBuffer = async (buffer) => {
|
|
|
32
32
|
const id = (Math.random() * new Date().getTime()).toString();
|
|
33
33
|
const message = { id, buffer };
|
|
34
34
|
worker.postMessage(message);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
35
|
+
const handleEvent = (event) => {
|
|
36
|
+
if (event.data.id === id) {
|
|
37
|
+
event.currentTarget.removeEventListener("message", handleEvent)
|
|
38
|
+
if (event.data.error) {
|
|
39
|
+
return reject(event.data.error);
|
|
40
|
+
}
|
|
41
|
+
return resolve(event.data.imageData);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
worker.addEventListener("message", handleEvent);
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
|