Skip to content

Commit

Permalink
waits for full inventory load before initial sorting #8
Browse files Browse the repository at this point in the history
  • Loading branch information
gergelyszabo94 committed Aug 18, 2019
1 parent ef51eb5 commit d655218
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion extension/chrome/js/content_scripts/steam/inventory.js
Expand Up @@ -132,6 +132,14 @@ window.addEventListener('message', e => {
inventoryPromise(e.data);
inventoryPromise = undefined;
}
else if (e.data.type === 'allItemsLoaded') {
if(e.data.allItemsLoaded){
doInitSorting();
}
else{
loadFullInventory();
}
}
});

//sends the message to the page side to get the info
Expand Down Expand Up @@ -224,7 +232,6 @@ function requestInventory(){
addClickListener();
addFunctionBar();
loadFullInventory();
doInitSorting();
}
else{
console.log("Wasn't able to get the inventory, it's most likely steam not working properly or you loading inventory pages at the same time");
Expand Down Expand Up @@ -1078,8 +1085,15 @@ function loadFullInventory() {
g_ActiveInventory.m_rgPages[i].EnsurePageItemsCreated();
g_ActiveInventory.PreloadPageImages(i);
}
window.postMessage({
type: 'allItemsLoaded',
allItemsLoaded: true
}, '*');
});`;
}
else{
doInitSorting();
}
isInventoryFullyLoaded = true;
}

Expand Down

0 comments on commit d655218

Please sign in to comment.