File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
Demo/Bit.Butil.Demo.Core/Pages Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ public class UserAgent(IJSRuntime js)
1313 /// Extracts the user agent properties from the browser or web-view.
1414 /// </summary>
1515 [ DynamicDependency ( DynamicallyAccessedMemberTypes . All , typeof ( UserAgentProperties ) ) ]
16- public async ValueTask < UserAgentProperties > Extract ( )
16+ public async ValueTask < UserAgentProperties > Extract ( string ? userAgentString )
1717 {
18- return await js . Invoke < UserAgentProperties > ( "BitButil.userAgent.extract" ) ;
18+ return await js . Invoke < UserAgentProperties > ( "BitButil.userAgent.extract" , userAgentString ) ;
1919 }
2020}
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ var BitButil = BitButil || {};
55 extract,
66 } ;
77
8- function extract ( ) {
8+ function extract ( userAgentString ?: string ) {
99 var nav = window . navigator ;
10- var ua = nav . userAgent || '' ;
10+ var ua = userAgentString || nav . userAgent || '' ;
1111
1212 var opera = ( window as any ) . operamini || ( window as any ) . opera ;
1313 var brave = ( nav as any ) . brave ;
@@ -423,7 +423,7 @@ var BitButil = BitButil || {};
423423 if ( description . length ) {
424424 userAgentProps . description = description . join ( ' ' ) ;
425425 }
426-
426+
427427 return userAgentProps ;
428428
429429 function getLayout ( guesses ) {
Original file line number Diff line number Diff line change 2424<hr />
2525<br />
2626
27+ <input @bind =" userAgentString" />
2728<button @onclick =" Extract" >Extract</button >
2829
2930<br />
3031<br />
3132
3233@code {
33- private async Task Extract ()
34+ private string ? userAgentString ;
35+
36+ private async Task Extract ()
3437 {
35- var userAgentProps = await userAgent .Extract ();
38+ var userAgentProps = await userAgent .Extract (userAgentString );
3639 await console .Log (" UserAgent properties:" , userAgentProps );
3740 }
3841}
You can’t perform that action at this time.
0 commit comments