Skip to content

Commit bada3e3

Browse files
Added implementations of members from IEventTargetInProcess to FileReaderInProcess.
1 parent e154631 commit bada3e3

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

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

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using KristofferStrube.Blazor.WebIDL;
1+
using KristofferStrube.Blazor.DOM;
2+
using KristofferStrube.Blazor.DOM.Extensions;
3+
using KristofferStrube.Blazor.WebIDL;
24
using Microsoft.JSInterop;
35
using System.Text.Json.Serialization;
46

@@ -8,7 +10,7 @@ namespace KristofferStrube.Blazor.FileAPI;
810
/// <see href="https://www.w3.org/TR/FileAPI/#dfn-filereader">FileReader browser specs</see>
911
/// </summary>
1012
[IJSWrapperConverter]
11-
public class FileReaderInProcess : FileReader, IJSInProcessCreatable<FileReaderInProcess, FileReader>
13+
public class FileReaderInProcess : FileReader, IJSInProcessCreatable<FileReaderInProcess, FileReader>, IEventTargetInProcess
1214
{
1315
/// <inheritdoc/>
1416
public new IJSInProcessObjectReference JSReference { get; set; }
@@ -240,6 +242,40 @@ public void InvokeOnLoadEnd(IJSInProcessObjectReference jsProgressEvent)
240242
OnLoadEnd.Invoke(new ProgressEventInProcess(JSRuntime, InProcessHelper, jsProgressEvent, new() { DisposesJSReference = true }));
241243
}
242244

245+
/// <inheritdoc/>
246+
public void AddEventListener<TInProcessEvent, TEvent>(string type, EventListenerInProcess<TInProcessEvent, TEvent>? callback, AddEventListenerOptions? options = null)
247+
where TEvent : Event, IJSCreatable<TEvent> where TInProcessEvent : IJSInProcessCreatable<TInProcessEvent, TEvent>
248+
{
249+
this.AddEventListener(InProcessHelper, type, callback, options);
250+
}
251+
252+
/// <inheritdoc/>
253+
public void AddEventListener<TInProcessEvent, TEvent>(EventListenerInProcess<TInProcessEvent, TEvent>? callback, AddEventListenerOptions? options = null)
254+
where TEvent : Event, IJSCreatable<TEvent> where TInProcessEvent : IJSInProcessCreatable<TInProcessEvent, TEvent>
255+
{
256+
this.AddEventListener(InProcessHelper, callback, options);
257+
}
258+
259+
/// <inheritdoc/>
260+
public void RemoveEventListener<TInProcessEvent, TEvent>(string type, EventListenerInProcess<TInProcessEvent, TEvent>? callback, EventListenerOptions? options = null)
261+
where TEvent : Event, IJSCreatable<TEvent> where TInProcessEvent : IJSInProcessCreatable<TInProcessEvent, TEvent>
262+
{
263+
this.RemoveEventListener(InProcessHelper, type, callback, options);
264+
}
265+
266+
/// <inheritdoc/>
267+
public void RemoveEventListener<TInProcessEvent, TEvent>(EventListenerInProcess<TInProcessEvent, TEvent>? callback, EventListenerOptions? options = null)
268+
where TEvent : Event, IJSCreatable<TEvent> where TInProcessEvent : IJSInProcessCreatable<TInProcessEvent, TEvent>
269+
{
270+
this.RemoveEventListener(InProcessHelper, callback, options);
271+
}
272+
273+
/// <inheritdoc/>
274+
public bool DispatchEvent(Event eventInstance)
275+
{
276+
return IEventTargetInProcessExtensions.DispatchEvent(this, eventInstance);
277+
}
278+
243279
/// <inheritdoc/>
244280
public new async ValueTask DisposeAsync()
245281
{

0 commit comments

Comments
 (0)