This commit is contained in:
Renan LE CARO 2025-03-18 15:26:56 +01:00
parent ffdbd71a88
commit 83b9b8b9e8
12 changed files with 7661 additions and 80 deletions

View file

@ -1,5 +1,5 @@
// The version of the cache.
const VERSION = "29038230";
const VERSION = "29038466";
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;

View file

@ -1 +1 @@
"29038230"
"29038466"

View file

@ -1284,9 +1284,7 @@ export function append<T>(
where.list[where.indexMin].destroyed = false;
makeItem(where.list[where.indexMin]);
where.indexMin++;
console.log("Reused item " + where.indexMin);
} else {
console.log("Created item " + where.indexMin);
const p = { destroyed: false };
makeItem(p);
where.list.push(p);
@ -1321,5 +1319,3 @@ export function forEachLiveOne<T>(
}
});
}
//TODO check destroyed usage in code

View file

@ -117,20 +117,42 @@ export function startRecordingGame(gameState: GameState) {
video.loop = true;
video.muted = true;
video.playsInline = true;
video.src = URL.createObjectURL(blob);
targetDiv.appendChild(video);
const a = document.createElement("a");
a.download = captureFileName("webm");
a.target = "_blank";
a.href = video.src;
if (window.location.href.endsWith("index.html?isInWebView=true")) {
a.href = await blobToBase64(blob);
} else {
a.href = video.src;
}
a.textContent = t("main_menu.record_download", {
size: (blob.size / 1000000).toFixed(2),
});
targetDiv.appendChild(video);
targetDiv.appendChild(a);
};
}
function blobToBase64(blob: Blob): Promise<string> {
return new Promise((resolve, reject) => {
let reader = new FileReader();
reader.onload = function () {
resolve(reader.result);
};
reader.onerror = function (e) {
console.error(e);
reject(new Error("Failed to readAsDataURL of the video "));
};
reader.readAsDataURL(blob);
});
}
export function pauseRecording() {
if (!isOptionOn("record")) {
return;

1
src/types.d.ts vendored
View file

@ -150,7 +150,6 @@ export type PerksMap = {
[k in PerkId]: number;
};
// TODO ensure T has a destroyed;boolean field
export type ReusableArray<T> = {
// All items below that index should not be destroyed
indexMin: number;