Giter Club home page Giter Club logo

Comments (2)

nenge123 avatar nenge123 commented on May 31, 2024

one way replace can auto save file

MEMFS.steam_ops.write

in the "node.useBytes === 0" next line add

Module.saveFIle(stream);


saveFIle:async stream=>{
let type = stream.path&&stream.path.split("/").pop();
if(!(/(srm$|state\d*)/.test(type))||Module[stream.path])return ;

let data = await (()=>new Promise(c=>{
let time = setInterval(()=>{
if(strem.fd==null){clearInterval(time);c(FS.readFile(stream.path))},1000/60
});
}))();
}

from webretro.

BinBashBanana avatar BinBashBanana commented on May 31, 2024

@DefaultAlias sorry for the late response, saves and states are stored in indexedDB, you can access them using this code:

let wIdb;
function openwIdb() {
	var request = indexedDB.open("webretro", 2);
	request.onsuccess = function(e) {
		wIdb = e.target.result;
	}
}
openwIdb();

function setIdbItem(key, value, customTransaction) {
	(customTransaction || wIdb.transaction("main", "readwrite")).objectStore("main").put({key: key, value: value});
}

function getIdbItem(key, customTransaction) {
	return new Promise(function(resolve) {
		(customTransaction || wIdb.transaction("main", "readwrite")).objectStore("main").get(key).onsuccess = function(e) {
			resolve(e.target.result ? e.target.result.value : null);
		}
	});
}

function getAllIdbItems(customTransaction) {
	return new Promise(function(resolve) {
		(customTransaction || wIdb.transaction("main", "readwrite")).objectStore("main").getAll().onsuccess = function(e) {
			resolve(e.target.result ? e.target.result : null);
		}
	});
}

function removeIdbItem(key, customTransaction) {
	(customTransaction || wIdb.transaction("main", "readwrite")).objectStore("main").delete(key);
}

getIdbItem and getAllIdbItems return promises, and can be awaited

You should use await getAllIdbItems() in the browser console to view the structure of the objects.

from webretro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.