Skip to content

Commit

Permalink
refactor: 重构代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgoZhang committed Feb 3, 2025
1 parent 63af32a commit 7398ea4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/BootstrapBlazor/Services/WebClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ public async Task<ClientInfo> GetClientInfo()
{
RequestUrl = navigation.Uri
};
_jsModule ??= await runtime.LoadModule("./_content/BootstrapBlazor/modules/client.js");
_interop ??= DotNetObjectReference.Create(this);
await _jsModule.InvokeVoidAsync("ping", "ip.axd", _interop, nameof(SetData));

// 等待 SetData 方法执行完毕
try
{
_jsModule ??= await runtime.LoadModuleByName("client");
_interop ??= DotNetObjectReference.Create(this);
await _jsModule.InvokeVoidAsync("ping", "ip.axd", _interop, nameof(SetData));

// 等待 SetData 方法执行完毕
await _taskCompletionSource.Task.WaitAsync(TimeSpan.FromSeconds(3));
}
catch (TimeoutException) { }
Expand Down

0 comments on commit 7398ea4

Please sign in to comment.