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 mousePosX, mousePosY, mouseInitPosX, mouseInitPosY;
|
||||
var isLive = false;
|
||||
var isScreenshotWaiting = false;
|
||||
|
||||
var createWebSocketConnection = function() {
|
||||
ws = new WebSocket('ws://' + window.location.hostname + ':14598');
|
||||
|
@ -28,6 +29,7 @@ var createWebSocketConnection = function() {
|
|||
$response.fadeOut();
|
||||
}, 2500);
|
||||
} else if (data.type === 'screenshot') {
|
||||
isScreenshotWaiting = false
|
||||
$screenshotImg.attr('src', 'data:image/png;base64, ' + data.value);
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +211,10 @@ var liveClickHandler = function(e, quality) {
|
|||
|
||||
var doScreenshot = function() {
|
||||
if (isLive) {
|
||||
ws.send(`{"type":"screenshot","quality":"${quality}"}`);
|
||||
if (!isScreenshotWaiting) {
|
||||
isScreenshotWaiting = true
|
||||
ws.send(`{"type":"screenshot","quality":"${quality}"}`);
|
||||
}
|
||||
|
||||
window.setTimeout(doScreenshot, 100);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue