1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Attempt #1 on preserving savegame files

This commit is contained in:
tobspr
2021-03-14 08:51:10 +01:00
parent 71d5b02e02
commit 5dddb846ef
7 changed files with 100 additions and 53 deletions

View File

@@ -58,11 +58,6 @@ export class StorageImplBrowser extends StorageInterface {
});
}
writeFileSyncIfSupported(filename, contents) {
window.localStorage.setItem(filename, contents);
return true;
}
readFileAsync(filename) {
if (this.currentBusyFilename === filename) {
logger.warn("Attempt to read", filename, "while write progress on it is ongoing!");

View File

@@ -94,12 +94,6 @@ export class StorageImplBrowserIndexedDB extends StorageInterface {
});
}
writeFileSyncIfSupported(filename, contents) {
// Not supported
this.writeFileAsync(filename, contents);
return true;
}
readFileAsync(filename) {
if (!this.database) {
return Promise.reject("Storage not ready");

View File

@@ -46,14 +46,6 @@ export class StorageImplElectron extends StorageInterface {
});
}
writeFileSyncIfSupported(filename, contents) {
return getIPCRenderer().sendSync("fs-sync-job", {
type: "write",
filename,
contents,
});
}
readFileAsync(filename) {
return new Promise((resolve, reject) => {
// ipcMain

View File

@@ -30,16 +30,6 @@ export class StorageInterface {
return Promise.reject();
}
/**
* Tries to write a file synchronously, used in unload handler
* @param {string} filename
* @param {string} contents
*/
writeFileSyncIfSupported(filename, contents) {
abstract;
return false;
}
/**
* Reads a string asynchronously. Returns Promise<FILE_NOT_FOUND> if file was not found.
* @param {string} filename