feat: add loading of recommendations to movie page

This commit is contained in:
2023-09-08 16:52:26 +02:00
parent 04c3578d61
commit 67c2785b80
9 changed files with 269 additions and 47 deletions

View File

@@ -47,6 +47,16 @@ export async function fetchStream(url: string, cb: (chunk: string) => void) {
}
}
export function hashString(message: string) {
let hash = 0;
for (let i = 0; i < message.length; i++) {
const char = message.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // Convert to 32bit integer
}
return hash;
}
export const createStreamResponse = () => {
let controller: ReadableStreamController<ArrayBufferView>;
const body = new ReadableStream({