Skip to content

Commit 0a7afef

Browse files
committed
doc: 更新注释
1 parent 6dd49e9 commit 0a7afef

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

src/BootstrapBlazor/Extensions/JSModuleExtensions.cs

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ namespace BootstrapBlazor.Components;
1111
public static class JSModuleExtensions
1212
{
1313
/// <summary>
14-
/// 导入 utility js 模块
14+
/// Load utility js module
1515
/// </summary>
16-
/// <param name="jsRuntime"></param>
17-
/// <param name="version"></param>
18-
/// <returns>A <see cref="Task"/><![CDATA[<]]><see cref="JSModule"/><![CDATA[>]]> 模块加载器</returns>
16+
/// <param name="jsRuntime">The <see cref="IJSRuntime"/> instance</param>
17+
/// <param name="version">The version of the module</param>
18+
/// <returns>A <see cref="Task"/><![CDATA[<]]><see cref="JSModule"/><![CDATA[>]]> module loader</returns>
1919
public static Task<JSModule> LoadUtility(this IJSRuntime jsRuntime, string? version = null) => LoadModuleByName(jsRuntime, "utility", version);
2020

2121
/// <summary>
22-
/// 通过名称导入内置脚本模块
22+
/// Load built-in script module by name
2323
/// </summary>
24-
/// <param name="jsRuntime"></param>
25-
/// <param name="moduleName"></param>
26-
/// <param name="version"></param>
27-
/// <returns>A <see cref="Task"/><![CDATA[<]]><see cref="JSModule"/><![CDATA[>]]> 模块加载器</returns>
24+
/// <param name="jsRuntime">The <see cref="IJSRuntime"/> instance</param>
25+
/// <param name="moduleName">The name of the module</param>
26+
/// <param name="version">The version of the module</param>
27+
/// <returns>A <see cref="Task"/><![CDATA[<]]><see cref="JSModule"/><![CDATA[>]]> module loader</returns>
2828
public static Task<JSModule> LoadModuleByName(this IJSRuntime jsRuntime, string moduleName, string? version = null)
2929
{
3030
var fileName = $"./_content/BootstrapBlazor/modules/{moduleName}.js";
3131
return LoadModule(jsRuntime, fileName, version);
3232
}
3333

3434
/// <summary>
35-
/// IJSRuntime 扩展方法 动态加载脚本
35+
/// IJSRuntime extension method to dynamically load scripts
3636
/// </summary>
37-
/// <param name="jsRuntime"></param>
38-
/// <param name="fileName"></param>
39-
/// <param name="version"></param>
40-
/// <returns>A <see cref="Task"/><![CDATA[<]]><see cref="JSModule"/><![CDATA[>]]> 模块加载器</returns>
37+
/// <param name="jsRuntime">The <see cref="IJSRuntime"/> instance</param>
38+
/// <param name="fileName">The file name of the script</param>
39+
/// <param name="version">The version of the script</param>
40+
/// <returns>A <see cref="Task"/><![CDATA[<]]><see cref="JSModule"/><![CDATA[>]]> module loader</returns>
4141
public static async Task<JSModule> LoadModule(this IJSRuntime jsRuntime, string fileName, string? version = null)
4242
{
4343
if (!string.IsNullOrEmpty(version))
@@ -64,10 +64,10 @@ public static async Task<JSModule> LoadModule(this IJSRuntime jsRuntime, string
6464
}
6565

6666
/// <summary>
67-
/// 获得指定类型的加载 Module 名称
67+
/// Get the module name of the specified type
6868
/// </summary>
69-
/// <param name="type"></param>
70-
/// <returns></returns>
69+
/// <param name="type">The type</param>
70+
/// <returns>The module name</returns>
7171
public static string GetTypeModuleName(this Type type)
7272
{
7373
var name = type.Name;
@@ -80,47 +80,47 @@ public static string GetTypeModuleName(this Type type)
8080
}
8181

8282
/// <summary>
83-
/// 在新标签页打开指定网址
83+
/// Open the specified URL in a new tab
8484
/// </summary>
85-
/// <param name="module"><see cref="JSModule"/> 实例</param>
86-
/// <param name="url">打开网页地址</param>
87-
/// <param name="target">默认 _blank</param>
88-
/// <param name="features">默认 null</param>
85+
/// <param name="module"><see cref="JSModule"/> instance</param>
86+
/// <param name="url">The URL to open</param>
87+
/// <param name="target">The target window, default is _blank</param>
88+
/// <param name="features">The features of the new window, default is null</param>
8989
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
9090
public static ValueTask OpenUrl(this JSModule module, string url, string? target = "_blank", string? features = null) => module.InvokeVoidAsync("openUrl", url, target, features);
9191

9292
/// <summary>
93-
/// 动态运行js代码
93+
/// Dynamically run js code
9494
/// </summary>
95-
/// <param name="module"><see cref="JSModule"/> 实例</param>
96-
/// <param name="script"></param>
95+
/// <param name="module"><see cref="JSModule"/> instance</param>
96+
/// <param name="script">The script to run</param>
9797
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
9898
public static async ValueTask Eval(this JSModule module, string script) => await module.InvokeVoidAsync("runEval", script);
9999

100100
/// <summary>
101-
/// 通过 Eval 动态运行 JavaScript 代码
101+
/// Dynamically run JavaScript code via Eval
102102
/// </summary>
103-
/// <param name="module"><see cref="JSModule"/> 实例</param>
104-
/// <param name="script"></param>
103+
/// <param name="module"><see cref="JSModule"/> instance</param>
104+
/// <param name="script">The script to run</param>
105105
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
106106
public static ValueTask<TValue?> Eval<TValue>(this JSModule module, string script) => module.InvokeAsync<TValue?>("runEval", script);
107107

108108
/// <summary>
109-
/// 通过 Function 动态运行 JavaScript 代码
109+
/// Dynamically run JavaScript code via Function
110110
/// </summary>
111-
/// <param name="module"><see cref="JSModule"/> 实例</param>
112-
/// <param name="script"></param>
113-
/// <param name="args"></param>
111+
/// <param name="module"><see cref="JSModule"/> instance</param>
112+
/// <param name="script">The script to run</param>
113+
/// <param name="args">The arguments to pass to the script</param>
114114
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
115115
public static ValueTask Function(this JSModule module, string script, params object?[]? args) => module.InvokeVoidAsync("runFunction", script, args);
116116

117117
/// <summary>
118-
/// 动态运行js代码
118+
/// Dynamically run js code
119119
/// </summary>
120-
/// <typeparam name="TValue"></typeparam>
121-
/// <param name="module"><see cref="JSModule"/> 实例</param>
122-
/// <param name="script"></param>
123-
/// <param name="args"></param>
120+
/// <typeparam name="TValue">The return type</typeparam>
121+
/// <param name="module"><see cref="JSModule"/> instance</param>
122+
/// <param name="script">The script to run</param>
123+
/// <param name="args">The arguments to pass to the script</param>
124124
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
125125
public static async ValueTask<TValue?> Function<TValue>(this JSModule module, string script, params object?[]? args)
126126
{
@@ -133,39 +133,39 @@ public static string GetTypeModuleName(this Type type)
133133
}
134134

135135
/// <summary>
136-
/// 获取当前终端是否为移动设备
136+
/// Check if the current terminal is a mobile device
137137
/// </summary>
138-
/// <param name="module"><see cref="JSModule"/> 实例</param>
138+
/// <param name="module"><see cref="JSModule"/> instance</param>
139139
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
140140
public static ValueTask<bool> IsMobile(this JSModule module) => module.InvokeAsync<bool>("isMobile");
141141

142142
/// <summary>
143-
/// 获取一个页面上不重复的元素ID
143+
/// Get a unique element ID on a page
144144
/// </summary>
145145
/// <param name="module">An instance of <see cref="JSModule"/></param>
146146
/// <param name="prefix">A prefix of type <see cref="string"/></param>
147147
/// <returns>Returns a <see cref="string"/> formatted element ID</returns>
148148
public static ValueTask<string?> GenerateId(this JSModule module, string? prefix = null) => module.InvokeAsync<string?>("getUID", prefix);
149149

150150
/// <summary>
151-
/// 获取一个页面内指定元素 Html 字符串
151+
/// Get the HTML string of a specified element on a page
152152
/// </summary>
153153
/// <param name="module">An instance of <see cref="JSModule"/></param>
154-
/// <param name="id"></param>
155-
/// <param name="selector"></param>
154+
/// <param name="id">The ID of the element</param>
155+
/// <param name="selector">The selector of the element</param>
156156
/// <returns>Returns a <see cref="string"/> formatted element ID</returns>
157157
public static ValueTask<string?> GetHtml(this JSModule module, string? id = null, string? selector = null) => module.InvokeAsync<string?>("getHtml", new { id, selector });
158158

159159
/// <summary>
160-
/// 设置主题方法
160+
/// Set the theme method
161161
/// </summary>
162162
/// <param name="module">An instance of <see cref="JSModule"/></param>
163-
/// <param name="themeName">theme name</param>
163+
/// <param name="themeName">The name of the theme</param>
164164
/// <returns></returns>
165165
public static ValueTask SetThemeAsync(this JSModule module, string themeName) => module.InvokeVoidAsync("setTheme", themeName, true);
166166

167167
/// <summary>
168-
/// 设置主题方法
168+
/// Get the theme method
169169
/// </summary>
170170
/// <param name="module">An instance of <see cref="JSModule"/></param>
171171
/// <returns></returns>

0 commit comments

Comments
 (0)