Closed Baileyeatspizza closed 2 years ago
Thanks for the PR but I implemented this myself as there were other changes needed and I wanted to keep the source code exactly in sync with the code in the Models published on Roblox and in my gists linked in the post.
Specifically I also had to lift the restriction that you can only disconnect a connection once because it's mostly incompatible with the Once API's semantics (it makes using the connection returned by Once difficult).
Overview and reasoning
This pull request aims to put GoodSignal on par with what Roblox is bringing in a future update
essentially this method is just syntax sugar for
Performance Comparison
(consider opening the results in fullscreen since it's hard to read in the preview đ) benchmarked using a Ryzen 9 3700X, your results may differ slightly
What do these results mean?
The benchmark directly compares Signal:Once and what was called syntax sugar previously. Demonstrating that the difference is negligible in most use cases for the added functionality and readability. Unfortunately, at the time of making this Roblox's implementation hasn't been released publically. So there is no way to reasonably compare it against it.
Changes are welcome
If you feel as if some part of the code can be changed to better suit the overall style of the module. Feel free to mention it in the comments or request an edit!
Closing
having a method to connect a signal and instantly disconnect has been a pretty standard feature in a few signal libraries here's an example SleitNicks implimentation now that Roblox has decided to adopt the implementation it only seems fitting that GoodSignal should as well.