Skip to content

Commit 63f99e6

Browse files
committed
refactor: 重构代码
1 parent 63af32a commit 63f99e6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/BootstrapBlazor/Services/WebClientService.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ public async Task<ClientInfo> GetClientInfo()
3939
{
4040
RequestUrl = navigation.Uri
4141
};
42-
_jsModule ??= await runtime.LoadModule("./_content/BootstrapBlazor/modules/client.js");
43-
_interop ??= DotNetObjectReference.Create(this);
44-
await _jsModule.InvokeVoidAsync("ping", "ip.axd", _interop, nameof(SetData));
4542

46-
// 等待 SetData 方法执行完毕
4743
try
4844
{
45+
_jsModule ??= await runtime.LoadModuleByName("client");
46+
_interop ??= DotNetObjectReference.Create(this);
47+
await _jsModule.InvokeVoidAsync("ping", "ip.axd", _interop, nameof(SetData));
48+
49+
// 等待 SetData 方法执行完毕
4950
await _taskCompletionSource.Task.WaitAsync(TimeSpan.FromSeconds(3));
5051
}
5152
catch (TimeoutException) { }

0 commit comments

Comments
 (0)