@@ -21,32 +21,36 @@ private async ValueTask<IJSObjectReference> GetHelperAsync()
21
21
22
22
public async ValueTask InstallHashWatcherAsync ( )
23
23
{
24
- var helpder = await this . GetHelperAsync ( ) ;
25
- await helpder . InvokeVoidAsync ( "installHashWatcher" ) ;
24
+ var helper = await this . GetHelperAsync ( ) ;
25
+ await helper . InvokeVoidAsync ( "installHashWatcher" ) ;
26
26
}
27
27
28
28
public async ValueTask ScrollToAnchorAsync ( string anchorName , bool smooth , bool changeUrl = false )
29
29
{
30
- var helpder = await this . GetHelperAsync ( ) ;
31
- await helpder . InvokeVoidAsync ( "scrollToAnchor" , anchorName . TrimStart ( '#' ) , smooth , changeUrl ) ;
30
+ var helper = await this . GetHelperAsync ( ) ;
31
+ await helper . InvokeVoidAsync ( "scrollToAnchor" , anchorName . TrimStart ( '#' ) , smooth , changeUrl ) ;
32
32
}
33
33
34
34
public async ValueTask < Theme > GetCurrentThemeAsync ( )
35
35
{
36
- var helpder = await this . GetHelperAsync ( ) ;
37
- var themeStr = await helpder . InvokeAsync < string > ( "getCurrentTheme" ) ;
36
+ var helper = await this . GetHelperAsync ( ) ;
37
+ var themeStr = await helper . InvokeAsync < string > ( "getCurrentTheme" ) ;
38
38
return ThemeExtension . Parse ( themeStr ) ;
39
39
}
40
40
41
41
public async ValueTask SetCurrentThemeAsync ( Theme theme )
42
42
{
43
- var helpder = await this . GetHelperAsync ( ) ;
44
- await helpder . InvokeVoidAsync ( "setCurrentTheme" , theme . ToKebabCase ( ) ) ;
43
+ var helper = await this . GetHelperAsync ( ) ;
44
+ await helper . InvokeVoidAsync ( "setCurrentTheme" , theme . ToKebabCase ( ) ) ;
45
45
}
46
46
47
47
public async ValueTask DisposeAsync ( )
48
48
{
49
- var helpder = await this . GetHelperAsync ( ) ;
50
- await helpder . DisposeAsync ( ) ;
49
+ if ( this . _Helper is not null )
50
+ {
51
+ try { await this . _Helper . DisposeAsync ( ) ; }
52
+ catch ( JSDisconnectedException ) { }
53
+ finally { this . _Helper = null ; }
54
+ }
51
55
}
52
56
}
0 commit comments