fix: URL revoke race in exportSave
URL.revokeObjectURL() was called synchronously after a.click(), but some browsers need the blob URL alive during download initiation. Now delayed 1s via setTimeout to let the download start safely. Fixes #63
This commit is contained in:
3
game.js
3
game.js
@@ -2842,7 +2842,8 @@ function exportSave() {
|
||||
const ts = new Date().toISOString().slice(0, 10);
|
||||
a.download = `beacon-save-${ts}.json`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
// Delay revoke to avoid race — some browsers need time to start the download
|
||||
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
||||
log('Save exported to file.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user