mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-10 21:14:06 -04:00
Only request debug data from VM thread if a debug tab is open
This commit is contained in:
parent
a47a9a9b7e
commit
890be6611e
1 changed files with 10 additions and 2 deletions
|
@ -51,11 +51,14 @@ window.onload = function() {
|
|||
}
|
||||
};
|
||||
|
||||
// Only request data from the VM thread if the appropriate tab is open.
|
||||
window.exploreTabOpen = false;
|
||||
var getPlaygroundData = function () {
|
||||
vm.getPlaygroundData();
|
||||
window.requestAnimationFrame(getPlaygroundData);
|
||||
if (window.exploreTabOpen) {
|
||||
window.requestAnimationFrame(getPlaygroundData);
|
||||
}
|
||||
};
|
||||
getPlaygroundData();
|
||||
|
||||
vm.on('playgroundData', function(data) {
|
||||
updateThreadExplorer(data.threads);
|
||||
|
@ -101,18 +104,23 @@ window.onload = function() {
|
|||
// Handlers to show different explorers.
|
||||
document.getElementById('threadexplorer-link').addEventListener('click',
|
||||
function () {
|
||||
window.exploreTabOpen = true;
|
||||
getPlaygroundData();
|
||||
tabBlockExplorer.style.display = 'none';
|
||||
tabRenderExplorer.style.display = 'none';
|
||||
tabThreadExplorer.style.display = 'block';
|
||||
});
|
||||
document.getElementById('blockexplorer-link').addEventListener('click',
|
||||
function () {
|
||||
window.exploreTabOpen = true;
|
||||
getPlaygroundData();
|
||||
tabBlockExplorer.style.display = 'block';
|
||||
tabRenderExplorer.style.display = 'none';
|
||||
tabThreadExplorer.style.display = 'none';
|
||||
});
|
||||
document.getElementById('renderexplorer-link').addEventListener('click',
|
||||
function () {
|
||||
window.exploreTabOpen = false;
|
||||
tabBlockExplorer.style.display = 'none';
|
||||
tabRenderExplorer.style.display = 'block';
|
||||
tabThreadExplorer.style.display = 'none';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue