mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-24 09:08:18 +00:00
Offload some more waveform processing onto a worker (#9223)
This commit is contained in:
committed by
GitHub
parent
ca25c8f430
commit
e1f7b0af2c
@@ -16,14 +16,19 @@ limitations under the License.
|
||||
|
||||
import { encode } from "blurhash";
|
||||
|
||||
import { WorkerPayload } from "./worker";
|
||||
|
||||
const ctx: Worker = self as any;
|
||||
|
||||
interface IBlurhashWorkerRequest {
|
||||
seq: number;
|
||||
export interface Request {
|
||||
imageData: ImageData;
|
||||
}
|
||||
|
||||
ctx.addEventListener("message", (event: MessageEvent<IBlurhashWorkerRequest>): void => {
|
||||
export interface Response {
|
||||
blurhash: string;
|
||||
}
|
||||
|
||||
ctx.addEventListener("message", (event: MessageEvent<Request & WorkerPayload>): void => {
|
||||
const { seq, imageData } = event.data;
|
||||
const blurhash = encode(
|
||||
imageData.data,
|
||||
|
||||
Reference in New Issue
Block a user