Skip to content

Commit

Permalink
⚡ Add configurable NftLoading delay
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePicco committed Jul 20, 2023
1 parent b3b779f commit b849640
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Runtime/codebase/Web3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public static event BalanceChange OnBalanceChange

private static List<Nft.Nft> _nfts = new();
private static bool _isLoadingNfts;
public static int NftLoadingRequestsDelay { get; set; } = 0;

public delegate void NFTsUpdate(List<Nft.Nft> nfts, int total);
private static event NFTsUpdate OnNFTsUpdateInternal;
Expand Down Expand Up @@ -372,7 +373,7 @@ public static async UniTask UpdateNFTs(Commitment commitment = Commitment.Confir
if (Application.platform == RuntimePlatform.WebGLPlayer)
{
// If we are on WebGL, we need to add a min delay between requests
requestsMillisecondsDelay = Mathf.Max(requestsMillisecondsDelay, 100);
requestsMillisecondsDelay = Mathf.Max(requestsMillisecondsDelay, 100, NftLoadingRequestsDelay);
}
if (requestsMillisecondsDelay > 0) await UniTask.Delay(requestsMillisecondsDelay);

Expand All @@ -395,7 +396,7 @@ public static async UniTask UpdateNFTs(Commitment commitment = Commitment.Confir
_nfts = nfts;
return nfts;
}

private static async UniTask SubscribeToWalletEvents(Commitment commitment = Commitment.Confirmed)
{
if(WsRpc == null) return;
Expand Down

0 comments on commit b849640

Please sign in to comment.