feat: preload image

This commit is contained in:
monoid 2025-08-15 21:44:37 +09:00
parent 5729caeea0
commit 8e08327dd9

View file

@ -69,7 +69,7 @@ function ComicViewer({
return () => { return () => {
img.removeEventListener("load", listener); img.removeEventListener("load", listener);
// abort loading // abort loading
img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=;'; img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
// TODO: use web worker to abort loading image in the future // TODO: use web worker to abort loading image in the future
}; };
} }
@ -85,6 +85,9 @@ function ComicViewer({
)} )}
alt="main content"/> alt="main content"/>
<div className="absolute right-0 w-1/2 h-full z-10 select-none" onMouseDown={() => pageUp(1)} /> <div className="absolute right-0 w-1/2 h-full z-10 select-none" onMouseDown={() => pageUp(1)} />
{curPage + 1 < totalPage && (
<img src={`/api/doc/${doc.id}/comic/${curPage + 1}`} alt="next page" className="sr-only" />
)}
</div> </div>
); );
} }