Replaced loadResource() with the more streamlined getResource(), for all your resource-getting needs (well, except for binary files, which should be coming soon)
This commit is contained in:
parent
466c087ece
commit
f032f95611
26 changed files with 3881 additions and 3777 deletions
|
|
@ -701,7 +701,9 @@ C1PDiskController.prototype.setBinding = function(sHTMLType, sBinding, control,
|
|||
sFileURL = "http://" + window.location.host + "/api/v1/dump?disk=" + sFilePath;
|
||||
}
|
||||
controller.println("loading " + str.getBaseName(sFilePath) + "...");
|
||||
web.loadResource(sFileURL, true, null, controller, controller.loadDisk);
|
||||
web.getResource(sFileURL, null, true, function(sURL, sResponse, nErrorCode) {
|
||||
controller.loadDisk(sURL, sResponse, nErrorCode);
|
||||
});
|
||||
}
|
||||
};
|
||||
}(this);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,10 @@ function C1PROM(parmsROM)
|
|||
if (sFileExt != DumpAPI.FORMAT.JSON && sFileExt != DumpAPI.FORMAT.HEX) {
|
||||
sFileURL = web.getHost() + DumpAPI.ENDPOINT + '?' + DumpAPI.QUERY.FILE + '=' + this.sImage + '&' + DumpAPI.QUERY.FORMAT + '=' + DumpAPI.FORMAT.BYTES;
|
||||
}
|
||||
web.loadResource(sFileURL, true, null, this, this.convertImage);
|
||||
var rom = this;
|
||||
web.getResource(sFileURL, null, true, function(sURL, sResponse, nErrorCode) {
|
||||
rom.convertImage(sURL, sResponse, nErrorCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,9 @@ C1PSerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sVal
|
|||
if (serial.bindings["listSerial"]) {
|
||||
var sFile = serial.bindings["listSerial"].value;
|
||||
// serial.println("loading " + sFile + "...");
|
||||
web.loadResource(sFile, true, null, serial, serial.loadFile);
|
||||
web.getResource(sFile, null, true, function(sURL, sResponse, nErrorCode) {
|
||||
serial.loadFile(sURL, sResponse, nErrorCode);
|
||||
});
|
||||
}
|
||||
};
|
||||
return true;
|
||||
|
|
@ -228,8 +230,8 @@ C1PSerialPort.prototype.startLoad = function()
|
|||
|
||||
/**
|
||||
* @this {C1PSerialPort}
|
||||
* @param {String} sFileName
|
||||
* @param {string} sFileData (null if loadResource() encountered an error)
|
||||
* @param {string} sFileName
|
||||
* @param {string} sFileData (null if getResource() encountered an error)
|
||||
* @param {number} nResponse from server
|
||||
*/
|
||||
C1PSerialPort.prototype.loadFile = function(sFileName, sFileData, nResponse)
|
||||
|
|
@ -245,7 +247,7 @@ C1PSerialPort.prototype.loadFile = function(sFileName, sFileData, nResponse)
|
|||
this.println("auto-loading " + sFileName);
|
||||
/*
|
||||
* QUESTION: Is this setFocus() call strictly necessary? We're being called in the
|
||||
* context of loadResource(), not some user action. If there was an original user action,
|
||||
* context of getResource(), not some user action. If there was an original user action,
|
||||
* then the handler for THAT action should take care to switch focus back, not us.
|
||||
*/
|
||||
this.cpu.setFocus();
|
||||
|
|
|
|||
Loading…
Reference in a new issue