Connections now have a proper .Connected property. Why, GoodSignal?
:DisconnectAll actually disconnects all connections, .Connected is set to false when it is called.
Added some extra type declaration on Signal methods, not big of a change;
The :DisconnectAll change means that the signal class is more consistent with BindableEvents and RBXScriptSignal behaviour as a whole.
For example, this piece of code changes what connections are fired depending on whether you're using my modified code or not. The modified version is consistent with what happens with a normal RBXScriptSignal.
local Event = Signal.new()
Event:Connect(function()
-- Fired second
print("This will not fire with the new changes")
end)
Event:Connect(function()
-- Fired first
Event:DisconnectAll() -- Same as :Destroy on instances
-- On RBXScriptSignals, and on the modified version, these connections are tagged as not connected, once :Fire goes over the next node (next connection), it will see that it's not connected, and not run it.
end)
Event:Fire()
This PR has made these changes:
.Connected
property. Why, GoodSignal?:DisconnectAll
actually disconnects all connections,.Connected
is set to false when it is called.The
:DisconnectAll
change means that the signal class is more consistent with BindableEvents and RBXScriptSignal behaviour as a whole.For example, this piece of code changes what connections are fired depending on whether you're using my modified code or not. The modified version is consistent with what happens with a normal RBXScriptSignal.
Note: This PR has not been tested.