Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 36 additions & 16 deletions Signals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,20 @@ public void RemoveListener(Action handler)
callback -= handler;
}

/// <summary>
/// Removes all listeners from this Signal
/// </summary>
public void RemoveAllListeners()
{
callback = null;
}

/// <summary>
/// Dispatch this signal
/// </summary>
public void Dispatch()
{
if(callback != null)
{
callback();
}
callback?.Invoke();
}
}

Expand Down Expand Up @@ -246,15 +251,20 @@ public void RemoveListener(Action<T> handler)
callback -= handler;
}

/// <summary>
/// Removes all listeners from this Signal
/// </summary>
public void RemoveAllListeners()
{
callback = null;
}

/// <summary>
/// Dispatch this signal with 1 parameter
/// </summary>
public void Dispatch(T arg1)
{
if (callback != null)
{
callback(arg1);
}
callback?.Invoke(arg1);
}
}

Expand Down Expand Up @@ -289,15 +299,20 @@ public void RemoveListener(Action<T, U> handler)
callback -= handler;
}

/// <summary>
/// Removes all listeners from this Signal
/// </summary>
public void RemoveAllListeners()
{
callback = null;
}

/// <summary>
/// Dispatch this signal
/// </summary>
public void Dispatch(T arg1, U arg2)
{
if (callback != null)
{
callback(arg1, arg2);
}
callback?.Invoke(arg1, arg2);
}
}

Expand Down Expand Up @@ -333,15 +348,20 @@ public void RemoveListener(Action<T, U, V> handler)
callback -= handler;
}

/// <summary>
/// Removes all listeners from this Signal
/// </summary>
public void RemoveAllListeners()
{
callback = null;
}

/// <summary>
/// Dispatch this signal
/// </summary>
public void Dispatch(T arg1, U arg2, V arg3)
{
if (callback != null)
{
callback(arg1, arg2, arg3);
}
callback?.Invoke(arg1, arg2, arg3);
}
}
}