Skip to content

Commit c01693d

Browse files
Fixed that ConnectAsync created an instance unnecesarily.
1 parent 807b04e commit c01693d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/KristofferStrube.Blazor.WebAudio/AudioNodes/AudioNode.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,18 @@ protected AudioNode(IJSRuntime jSRuntime, IJSObjectReference jSReference, Creati
5959
/// It is possible to connect more than one <see cref="AudioNode"/> output to a single <see cref="AudioParam"/> with multiple calls to <see cref="ConnectAsync(AudioNode, ulong, ulong)"/>. Thus, "fan-in" is supported.<br />
6060
/// It throws an <see cref="InvalidAccessErrorException"/> if <paramref name="destinationNode"/> is an <see cref="AudioNode"/> that has been created using another <see cref="AudioContext"/>.<br/>
6161
/// It throws an <see cref="IndexSizeErrorException"/> if the <paramref name="output"/> is out of bounds.<br />
62-
/// It throws an <see cref="IndexSizeErrorException"/> if the <paramref name="input"/> is out of bounds.
62+
/// It throws an <see cref="IndexSizeErrorException"/> if the <paramref name="input"/> is out of bounds.<br />
63+
/// It does not return anything even though the specification says that it should return the <paramref name="destinationNode"/> as chaining is not possible in async code.
6364
/// </remarks>
6465
/// <param name="destinationNode">The destination parameter is the <see cref="AudioNode"/> to connect to.</param>
6566
/// <param name="output">The output parameter is an index describing which output of the <see cref="AudioNode"/> from which to connect.</param>
6667
/// <param name="input">The input parameter is an index describing which input of the destination <see cref="AudioNode"/> to connect to.</param>
6768
/// <exception cref="InvalidAccessErrorException" />
6869
/// <exception cref="IndexSizeErrorException" />
69-
/// <returns>This method returns destination AudioNode object.</returns>
70-
public async Task<AudioNode> ConnectAsync(AudioNode destinationNode, ulong output = 0, ulong input = 0)
70+
public async Task ConnectAsync(AudioNode destinationNode, ulong output = 0, ulong input = 0)
7171
{
7272
IJSObjectReference jSReference = errorHandlingJSReference ?? JSReference;
73-
IJSObjectReference jSInstance = await jSReference.InvokeAsync<IJSObjectReference>("connect", destinationNode, output, input);
74-
return await CreateAsync(JSRuntime, jSInstance);
73+
await jSReference.InvokeVoidAsync("connect", destinationNode, output, input);
7574
}
7675

7776
/// <summary>

0 commit comments

Comments
 (0)