-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Array support for Select and Tabs' methods.
- Loading branch information
Showing
7 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace BlazorMaterialWeb.Common; | ||
|
||
public interface IJSArrayReference<T> | ||
{ | ||
IJSObjectReference JSObjectReference { get; } | ||
|
||
Task<T> GetItemAsync(long index); | ||
Task<long> GetLengthAsync(); | ||
} | ||
|
||
class JSArrayReference<T> : IJSArrayReference<T> | ||
{ | ||
readonly IJSObjectReference jsRef; | ||
readonly IJSRuntime js; | ||
|
||
public JSArrayReference(IJSObjectReference jsRef, IJSRuntime js) | ||
{ | ||
this.jsRef = jsRef; | ||
this.js = js; | ||
} | ||
|
||
public IJSObjectReference JSObjectReference => jsRef; | ||
|
||
public async Task<long> GetLengthAsync() => | ||
await js.GetObjectPropertyAsync<long>(jsRef, "length"); | ||
|
||
public async Task<T> GetItemAsync(long index) => | ||
await js.GetArrayElementAsync<T>(jsRef, index); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters