Skip to content

Commit d8a3581

Browse files
committed
Comments update
1 parent 1914a5b commit d8a3581

2 files changed

Lines changed: 54 additions & 8 deletions

File tree

SpawnDev.BlazorJS/Events/ActionEvent.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
/// With ActionEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
55
/// All reference handling is done automatically when events are added and removed.<br/>
66
/// Parameters of event handlers may be omitted if not required.<br/>
7+
/// <br/>
8+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
9+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
10+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
11+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).<br/>
12+
/// <br/>
713
/// For example, many JSObjects have ActionEvent properties like the one below:<br/>
814
/// <br/>
915
/// public ActionEvent&lt;Event> OnChange { get => new ActionEvent&lt;Event>("change", AddEventListener, RemoveEventListener); set { } }<br/>

SpawnDev.BlazorJS/Events/FuncEvent.cs

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
55
/// All reference handling is done automatically when events are added and removed.<br/>
66
/// Parameters of event handlers may be omitted if not required.<br/>
7-
/// FuncEvent works just like ActionEvent but allows a return value.
7+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
8+
/// <br/>
9+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
10+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
11+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
12+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
813
/// </summary>
914
public class FuncEvent<TResult> : CallbackEvent
1015
{
@@ -71,7 +76,12 @@ public virtual void Off(Func<TResult> listener)
7176
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
7277
/// All reference handling is done automatically when events are added and removed.<br/>
7378
/// Parameters of event handlers may be omitted if not required.<br/>
74-
/// FuncEvent works just like ActionEvent but allows a return value.
79+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
80+
/// <br/>
81+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
82+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
83+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
84+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
7585
/// </summary>
7686
public class FuncEvent<T1, TResult> : FuncEvent<TResult>
7787
{
@@ -157,7 +167,12 @@ public virtual void Off(Func<T1, TResult> listener)
157167
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
158168
/// All reference handling is done automatically when events are added and removed.<br/>
159169
/// Parameters of event handlers may be omitted if not required.<br/>
160-
/// FuncEvent works just like ActionEvent but allows a return value.
170+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
171+
/// <br/>
172+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
173+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
174+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
175+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
161176
/// </summary>
162177
public class FuncEvent<T1, T2, TResult> : FuncEvent<T1, TResult>
163178
{
@@ -262,7 +277,12 @@ public virtual void Off(Func<T1, T2, TResult> listener)
262277
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
263278
/// All reference handling is done automatically when events are added and removed.<br/>
264279
/// Parameters of event handlers may be omitted if not required.<br/>
265-
/// FuncEvent works just like ActionEvent but allows a return value.
280+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
281+
/// <br/>
282+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
283+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
284+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
285+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
266286
/// </summary>
267287
public class FuncEvent<T1, T2, T3, TResult> : FuncEvent<T1, T2, TResult>
268288
{
@@ -386,7 +406,12 @@ public virtual void Off(Func<T1, T2, T3, TResult> listener)
386406
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
387407
/// All reference handling is done automatically when events are added and removed.<br/>
388408
/// Parameters of event handlers may be omitted if not required.<br/>
389-
/// FuncEvent works just like ActionEvent but allows a return value.
409+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
410+
/// <br/>
411+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
412+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
413+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
414+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
390415
/// </summary>
391416
public class FuncEvent<T1, T2, T3, T4, TResult> : FuncEvent<T1, T2, T3, TResult>
392417
{
@@ -529,7 +554,12 @@ public virtual void Off(Func<T1, T2, T3, T4, TResult> listener)
529554
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
530555
/// All reference handling is done automatically when events are added and removed.<br/>
531556
/// Parameters of event handlers may be omitted if not required.<br/>
532-
/// FuncEvent works just like ActionEvent but allows a return value.
557+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
558+
/// <br/>
559+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
560+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
561+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
562+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
533563
/// </summary>
534564
public class FuncEvent<T1, T2, T3, T4, T5, TResult> : FuncEvent<T1, T2, T3, T4, TResult>
535565
{
@@ -691,7 +721,12 @@ public virtual void Off(Func<T1, T2, T3, T4, T5, TResult> listener)
691721
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
692722
/// All reference handling is done automatically when events are added and removed.<br/>
693723
/// Parameters of event handlers may be omitted if not required.<br/>
694-
/// FuncEvent works just like ActionEvent but allows a return value.
724+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
725+
/// <br/>
726+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
727+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
728+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
729+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
695730
/// </summary>
696731
public class FuncEvent<T1, T2, T3, T4, T5, T6, TResult> : FuncEvent<T1, T2, T3, T4, T5, TResult>
697732
{
@@ -872,7 +907,12 @@ public virtual void Off(Func<T1, T2, T3, T4, T5, T6, TResult> listener)
872907
/// With FuncEvent the operands += and -= can be used to attach and detach .Net callbacks to Javascript events.<br/>
873908
/// All reference handling is done automatically when events are added and removed.<br/>
874909
/// Parameters of event handlers may be omitted if not required.<br/>
875-
/// FuncEvent works just like ActionEvent but allows a return value.
910+
/// FuncEvent works just like ActionEvent but allows a return value.<br/>
911+
/// <br/>
912+
/// <b>IMPORTANT: Every += must have a matching -= before the JSObject is disposed.</b><br/>
913+
/// Failing to unsubscribe before disposal will cause the JavaScript callback to persist,<br/>
914+
/// leading to memory leaks and potential calls into disposed .NET objects which can<br/>
915+
/// trigger unhandled exceptions (e.g., Blazor error UI in WASM).
876916
/// </summary>
877917
public class FuncEvent<T1, T2, T3, T4, T5, T6, T7, TResult> : FuncEvent<T1, T2, T3, T4, T5, T6, TResult>
878918
{

0 commit comments

Comments
 (0)