Skip to content

Commit

Permalink
Merge pull request #13 from KristofferStrube/fix/read-needs-to-be-inv…
Browse files Browse the repository at this point in the history
…oked-directly-on-jsreference

Fixed that `ReadableStreamBYOBReaderInProcess` did not invoke `read` on the `JSReference` itself.
  • Loading branch information
KristofferStrube authored Mar 10, 2024
2 parents df8c89f + 4b0b54e commit a709f62
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ internal ReadableStreamBYOBReaderInProcess(IJSRuntime jSRuntime, IJSInProcessObj
/// <returns>The next chunk of the underlying <see cref="ReadableStream"/>.</returns>
public new async Task<ReadableStreamReadResultInProcess> ReadAsync(IArrayBufferView view)
{
IJSInProcessObjectReference jSInstance = await inProcessHelper.InvokeAsync<IJSInProcessObjectReference>("read", view.JSReference);
IJSInProcessObjectReference jSInstance = await JSReference.InvokeAsync<IJSInProcessObjectReference>("read", view.JSReference);
return new ReadableStreamReadResultInProcess(JSRuntime, inProcessHelper, jSInstance, new() { DisposesJSReference = true });
}

/// <summary>
/// Reads a chunk of a stream.
/// </summary>
/// <param name="view">The <see cref="IArrayBufferView"/> that is used as a buffer</param>
/// <param name="options">The options for how the chunk is to be read.</param>
/// <returns>The next chunk of the underlying <see cref="ReadableStream"/>.</returns>
public new async Task<ReadableStreamReadResultInProcess> ReadAsync(IArrayBufferView view, ReadableStreamBYOBReaderReadOptions? options = null)
{
IJSInProcessObjectReference jSInstance = await inProcessHelper.InvokeAsync<IJSInProcessObjectReference>("read", view.JSReference, options);
IJSInProcessObjectReference jSInstance = await JSReference.InvokeAsync<IJSInProcessObjectReference>("read", view.JSReference, options);
return new ReadableStreamReadResultInProcess(JSRuntime, inProcessHelper, jSInstance, new() { DisposesJSReference = true });
}

Expand Down

0 comments on commit a709f62

Please sign in to comment.