next-blurhash-previews 0.0.3-beta68 → 0.0.3-beta70

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.
@@ -49,7 +49,7 @@ export async function getBlurhash(path) {
49
49
  }
50
50
 
51
51
  return new Promise((res, rej) => {
52
- blurhashImage
52
+ (previewImage ?? blurhashImage)
53
53
  .raw()
54
54
  .ensureAlpha()
55
55
  .toBuffer((err, buffer) => {
@@ -76,7 +76,6 @@ const workerBlob = new Blob(
76
76
  [document.querySelector("#next-blurhash-worker-script")!.textContent!],
77
77
  { type: "text/javascript" }
78
78
  );
79
- const worker = new Worker(window.URL.createObjectURL(workerBlob));
80
79
 
81
80
  function updateBlurHashPreview(canvasEl: HTMLCanvasElement, preview: blurhash) {
82
81
  const { w: width, h: height, blurhash } = preview;
@@ -84,6 +83,7 @@ function updateBlurHashPreview(canvasEl: HTMLCanvasElement, preview: blurhash) {
84
83
  canvasEl.height = height;
85
84
 
86
85
  if (true) {
86
+ const worker = new Worker(window.URL.createObjectURL(workerBlob));
87
87
  const offscreen = (canvasEl as any).transferControlToOffscreen();
88
88
  worker.postMessage({ canvas: offscreen, width, height, blurhash }, [
89
89
  offscreen,
@@ -279,7 +279,6 @@ if (!customElements.get("blurhash-image")) {
279
279
  const workerBlob = new Blob([document.querySelector("#next-blurhash-worker-script").textContent], {
280
280
  type: "text/javascript"
281
281
  });
282
- const worker = new Worker(window.URL.createObjectURL(workerBlob));
283
282
  function updateBlurHashPreview(canvasEl, preview) {
284
283
  const {
285
284
  w: width,
@@ -289,6 +288,7 @@ function updateBlurHashPreview(canvasEl, preview) {
289
288
  canvasEl.width = width;
290
289
  canvasEl.height = height;
291
290
  {
291
+ const worker = new Worker(window.URL.createObjectURL(workerBlob));
292
292
  const offscreen = canvasEl.transferControlToOffscreen();
293
293
  worker.postMessage({
294
294
  canvas: offscreen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-blurhash-previews",
3
- "version": "0.0.3-beta68",
3
+ "version": "0.0.3-beta70",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",