mirror of
https://github.com/yuzu-emu/liftinstall.git
synced 2025-07-23 07:28:24 +00:00
Buffer incoming streamed data in the frontend
This commit is contained in:
parent
4d3ce45dc4
commit
d53603e211
|
@ -32,11 +32,13 @@ where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
/// Unwraps this object. See `unwrap()`.
|
/// Unwraps this object. See `unwrap()`.
|
||||||
|
#[inline]
|
||||||
fn log_unwrap(self) -> T {
|
fn log_unwrap(self) -> T {
|
||||||
self.log_expect("Failed to unwrap")
|
self.log_expect("Failed to unwrap")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unwraps this object, with a specified error message on failure. See `expect()`.
|
/// Unwraps this object, with a specified error message on failure. See `expect()`.
|
||||||
|
#[inline]
|
||||||
fn log_expect(self, msg: &str) -> T;
|
fn log_expect(self, msg: &str) -> T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,13 +73,19 @@ function stream_ajax(path, callback, successCallback, failCallback, data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var buffer = "";
|
||||||
|
|
||||||
req.onreadystatechange = function() {
|
req.onreadystatechange = function() {
|
||||||
if(req.readyState > 2) {
|
if(req.readyState > 2) {
|
||||||
var newData = req.responseText.substr(req.seenBytes);
|
var newData = req.responseText.substr(req.seenBytes);
|
||||||
|
|
||||||
var lines = newData.split("\n");
|
buffer += newData;
|
||||||
for (var i = 0; i < lines.length; i++) {
|
|
||||||
var line = lines[i].trim();
|
var pointer;
|
||||||
|
while ((pointer = newData.indexOf("\n")) >= 0) {
|
||||||
|
var line = newData.substring(0, pointer).trim();
|
||||||
|
newData = newData.substring(pointer + 1);
|
||||||
|
|
||||||
if (line.length === 0) {
|
if (line.length === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue