Commit 41d4757f authored by Chunchi Che's avatar Chunchi Che

optimize download

parent be22e94a
...@@ -43,8 +43,19 @@ export const EndModal: React.FC = () => { ...@@ -43,8 +43,19 @@ export const EndModal: React.FC = () => {
const blob = new Blob(replayBuffers, { const blob = new Blob(replayBuffers, {
type: "application/octet-stream", type: "application/octet-stream",
}); });
const url = URL.createObjectURL(blob);
const anchorElement = document.createElement("a");
document.body.appendChild(anchorElement);
anchorElement.style.display = "none";
anchorElement.href = url;
anchorElement.download =
new Date().toLocaleString() + ".neos" + ".yrp3d";
anchorElement.click();
// download the replay file // download the replay file
window.open(URL.createObjectURL(blob)); window.URL.revokeObjectURL(url);
} }
onReturn(); onReturn();
}} }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment