1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/components/images/blurhash.worker.ts

16 lines
444 B
TypeScript

/* eslint-disable no-restricted-globals */
import { decode } from 'blurhash';
self.onmessage = ({ data: { hash, width, height } }): void => {
try {
self.postMessage({
pixels: decode(hash, width, height),
hsh: hash,
width: width,
height: height
});
} catch {
throw new TypeError(`Blurhash ${hash} is not valid`);
}
};
/* eslint-enable no-restricted-globals */