Skip to content

Commit 117c919

Browse files
Made sure that ReadableStreams are created with responsible to dispose JSReference.
1 parent f5cc307 commit 117c919

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/KristofferStrube.Blazor.FileAPI/Blob.InProcess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected internal BlobInProcess(IJSRuntime jSRuntime, IJSInProcessObjectReferen
6464
public new async Task<ReadableStreamInProcess> StreamAsync()
6565
{
6666
IJSInProcessObjectReference jSInstance = JSReference.Invoke<IJSInProcessObjectReference>("stream");
67-
return await ReadableStreamInProcess.CreateAsync(JSRuntime, jSInstance);
67+
return await ReadableStreamInProcess.CreateAsync(JSRuntime, jSInstance, new() { DisposesJSReference = true });
6868
}
6969

7070
/// <summary>

src/KristofferStrube.Blazor.FileAPI/Blob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public async Task<Blob> SliceAsync(long? start = null, long? end = null, string?
103103
public async Task<ReadableStream> StreamAsync()
104104
{
105105
IJSObjectReference jSInstance = await JSReference.InvokeAsync<IJSObjectReference>("stream");
106-
return await ReadableStream.CreateAsync(JSRuntime, jSInstance);
106+
return await ReadableStream.CreateAsync(JSRuntime, jSInstance, new() { DisposesJSReference = true });
107107
}
108108

109109
/// <summary>

src/KristofferStrube.Blazor.FileAPI/File.InProcess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected FileInProcess(IJSRuntime jSRuntime, IJSInProcessObjectReference inProc
6565
public new async Task<ReadableStreamInProcess> StreamAsync()
6666
{
6767
IJSInProcessObjectReference jSInstance = JSReference.Invoke<IJSInProcessObjectReference>("stream");
68-
return await ReadableStreamInProcess.CreateAsync(JSRuntime, jSInstance);
68+
return await ReadableStreamInProcess.CreateAsync(JSRuntime, jSInstance, new() { DisposesJSReference = true });
6969
}
7070

7171
/// <summary>

0 commit comments

Comments
 (0)