add isScreenshotWaiting var
This commit is contained in:
parent
fc56154edb
commit
506dc259ca
|
@ -3,6 +3,7 @@ var $pointer, $scroller, $response, $screenshotImg;
|
||||||
var scrollLastTimestamp, scrollLastValue;
|
var scrollLastTimestamp, scrollLastValue;
|
||||||
var mousePosX, mousePosY, mouseInitPosX, mouseInitPosY;
|
var mousePosX, mousePosY, mouseInitPosX, mouseInitPosY;
|
||||||
var isLive = false;
|
var isLive = false;
|
||||||
|
var isScreenshotWaiting = false;
|
||||||
|
|
||||||
var createWebSocketConnection = function() {
|
var createWebSocketConnection = function() {
|
||||||
ws = new WebSocket('ws://' + window.location.hostname + ':14598');
|
ws = new WebSocket('ws://' + window.location.hostname + ':14598');
|
||||||
|
@ -28,6 +29,7 @@ var createWebSocketConnection = function() {
|
||||||
$response.fadeOut();
|
$response.fadeOut();
|
||||||
}, 2500);
|
}, 2500);
|
||||||
} else if (data.type === 'screenshot') {
|
} else if (data.type === 'screenshot') {
|
||||||
|
isScreenshotWaiting = false
|
||||||
$screenshotImg.attr('src', 'data:image/png;base64, ' + data.value);
|
$screenshotImg.attr('src', 'data:image/png;base64, ' + data.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +211,10 @@ var liveClickHandler = function(e, quality) {
|
||||||
|
|
||||||
var doScreenshot = function() {
|
var doScreenshot = function() {
|
||||||
if (isLive) {
|
if (isLive) {
|
||||||
ws.send(`{"type":"screenshot","quality":"${quality}"}`);
|
if (!isScreenshotWaiting) {
|
||||||
|
isScreenshotWaiting = true
|
||||||
|
ws.send(`{"type":"screenshot","quality":"${quality}"}`);
|
||||||
|
}
|
||||||
|
|
||||||
window.setTimeout(doScreenshot, 100);
|
window.setTimeout(doScreenshot, 100);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue