Seed Support #56
1 changed files with 7 additions and 3 deletions
|
@ -517,7 +517,7 @@ lbry._updateClaimOwnershipCache = function(claimId) {
|
||||||
lbry.getMyClaims((claimInfos) => {
|
lbry.getMyClaims((claimInfos) => {
|
||||||
lbry._claimIdOwnershipCache[claimId] = !!claimInfos.reduce(function(match, claimInfo) {
|
lbry._claimIdOwnershipCache[claimId] = !!claimInfos.reduce(function(match, claimInfo) {
|
||||||
return match || claimInfo.claim_id == claimId;
|
return match || claimInfo.claim_id == claimId;
|
||||||
}, false);
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -570,6 +570,7 @@ lbry.fileInfoUnsubscribe = function(outpoint, subscribeId) {
|
||||||
delete lbry._fileInfoSubscribeCallbacks[outpoint][subscribeId];
|
delete lbry._fileInfoSubscribeCallbacks[outpoint][subscribeId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lbry._balanceUpdateInterval = null;
|
||||||
lbry._updateBalanceSubscribers = function() {
|
lbry._updateBalanceSubscribers = function() {
|
||||||
lbry.get_balance().then(function(balance) {
|
lbry.get_balance().then(function(balance) {
|
||||||
for (let callback of Object.values(lbry._balanceSubscribeCallbacks)) {
|
for (let callback of Object.values(lbry._balanceSubscribeCallbacks)) {
|
||||||
|
@ -577,8 +578,8 @@ lbry._updateBalanceSubscribers = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Object.keys(lbry._balanceSubscribeCallbacks).length) {
|
if (!lbry._balanceUpdateInterval && Object.keys(lbry._balanceSubscribeCallbacks).length) {
|
||||||
setTimeout(() => {
|
lbry._balanceUpdateInterval = setInterval(() => {
|
||||||
lbry._updateBalanceSubscribers();
|
lbry._updateBalanceSubscribers();
|
||||||
}, lbry._balanceSubscribeInterval);
|
}, lbry._balanceSubscribeInterval);
|
||||||
}
|
}
|
||||||
|
@ -593,6 +594,9 @@ lbry.balanceSubscribe = function(callback) {
|
||||||
|
|
||||||
lbry.balanceUnsubscribe = function(subscribeId) {
|
lbry.balanceUnsubscribe = function(subscribeId) {
|
||||||
delete lbry._balanceSubscribeCallbacks[subscribeId];
|
delete lbry._balanceSubscribeCallbacks[subscribeId];
|
||||||
|
if (lbry._balanceUpdateInterval && !Object.keys(lbry._balanceSubscribeCallbacks).length) {
|
||||||
|
clearInterval(lbry._balanceUpdateInterval)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lbry.showMenuIfNeeded = function() {
|
lbry.showMenuIfNeeded = function() {
|
||||||
|
|
Loading…
Reference in a new issue