Skip to content

Commit

Permalink
Added onEnded event handler to AudioScheduledSourceNode.
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferStrube committed Aug 26, 2024
1 parent 049d443 commit cf0a8a8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
private (int start, int end)[] supportedRows = new (int start, int end)[] {
(0, 16),
(19, 41),
(46, 200),
(202, 266),
(46, 266),
(269, 269),
(285, 396),
(421, 468),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using KristofferStrube.Blazor.WebIDL;
using KristofferStrube.Blazor.DOM;
using KristofferStrube.Blazor.WebIDL;
using Microsoft.JSInterop;

namespace KristofferStrube.Blazor.WebAudio;
Expand Down Expand Up @@ -30,6 +31,26 @@ protected AudioScheduledSourceNode(IJSRuntime jSRuntime, IJSObjectReference jSRe
{
}

/// <summary>
/// Adds an <see cref="EventListener{TEvent}"/> for when the <see cref="AudioScheduledSourceNode"/> ends.
/// </summary>
/// <param name="callback">Callback that will be invoked when the event is dispatched.</param>
/// <param name="options"><inheritdoc cref="EventTarget.AddEventListenerAsync{TEvent}(string, EventListener{TEvent}?, AddEventListenerOptions?)" path="/param[@name='options']"/></param>
public async Task AddOnEndedEventListenerAsync(EventListener<Event> callback, AddEventListenerOptions? options = null)
{
await AddEventListenerAsync("ended", callback, options);
}

/// <summary>
/// Removes the event listener from the event listener list if it has been parsed to <see cref="AddOnEndedEventListenerAsync"/> previously.
/// </summary>
/// <param name="callback">The callback <see cref="EventListener{TEvent}"/> that you want to stop listening to events.</param>
/// <param name="options"><inheritdoc cref="EventTarget.RemoveEventListenerAsync{TEvent}(string, EventListener{TEvent}?, EventListenerOptions?)" path="/param[@name='options']"/></param>
public async Task RemoveOnErrorEventListenerAsync(EventListener<Event> callback, EventListenerOptions? options = null)
{
await RemoveEventListenerAsync("ended", callback, options);
}

/// <summary>
/// Schedules a sound to playback at an exact time.
/// </summary>
Expand Down

0 comments on commit cf0a8a8

Please sign in to comment.