Rename OnJSONLoaded & small refactor
This commit is contained in:
parent
aea2409b1d
commit
028e131ddb
|
@ -56,7 +56,6 @@ function FS(storage, qidcounter) {
|
|||
this.storage = storage;
|
||||
|
||||
this.qidcounter = qidcounter || { last_qidnumber: 0 };
|
||||
this.OnLoaded = function() {};
|
||||
|
||||
//this.tar = new TAR(this);
|
||||
|
||||
|
@ -159,11 +158,11 @@ FS.prototype.HandleEvent = function(id) {
|
|||
this.events = newevents;
|
||||
};
|
||||
|
||||
FS.prototype.OnJSONLoaded = function(fs)
|
||||
FS.prototype.load_from_json = function(fs, done)
|
||||
{
|
||||
if(DEBUG)
|
||||
{
|
||||
console.assert(fs, "Invalid fs passed to OnJSONLoaded");
|
||||
console.assert(fs, "Invalid fs passed to load_from_json");
|
||||
}
|
||||
|
||||
//console.time("parse");
|
||||
|
@ -198,8 +197,7 @@ FS.prototype.OnJSONLoaded = function(fs)
|
|||
// console.timeEnd("Check");
|
||||
//}
|
||||
|
||||
me.OnLoaded();
|
||||
me.OnLoaded = function() {};
|
||||
done();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
|
|
|
@ -552,7 +552,7 @@ V86Starter.prototype.continue_init = function(emulator, options)
|
|||
{
|
||||
if(!settings.initial_state)
|
||||
{
|
||||
settings.fs9p.OnJSONLoaded(settings.fs9p_json);
|
||||
settings.fs9p.load_from_json(settings.fs9p_json);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1084,8 +1084,7 @@ V86Starter.prototype.mount_fs = function(path, baseurl, basefs, callback)
|
|||
if(baseurl)
|
||||
{
|
||||
dbg_assert(typeof basefs === "string", "Filesystem: basefs must be a JSON string");
|
||||
newfs.OnJSONLoaded(basefs);
|
||||
newfs.OnLoaded = mount;
|
||||
newfs.load_from_json(basefs, () => mount());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1652,11 +1652,7 @@ function reload_fsjson()
|
|||
if(tests[test_num].use_fsjson)
|
||||
{
|
||||
console.log(" Reloading files from json");
|
||||
emulator.fs9p.OnJSONLoaded(testfsjson);
|
||||
emulator.fs9p.OnLoaded = () =>
|
||||
{
|
||||
do_mounts();
|
||||
};
|
||||
emulator.fs9p.load_from_json(testfsjson, () => do_mounts());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue