FastSignal - Create custom events!

Hi! This is my Signal library.

This Signal library has made in mind for BadgeService3, but has been changed since then to suit most use cases and to have the best performance I could get, while still being majorly compatible.

It’s a simple library that follows the same function names and some other characterists from other libraries, you might even be able to just replace your existing Signal library with this if you wanted to.


This library has support for:

  • Deferred Events
  • Parallel Lua

This library is now based on Stravant’s G’Signal implementation. It was previously based on BindableEvents. There are some changes from his implementation, this does offer Parallel Lua support, and it uses task.defer while G’Signal uses task.spawn because it recycles threads, also any features from before are still valid here.


Download :sparkles: GitHub

:sparkles: Documentation :sparkles:


Feel free to test it, try it out and get some knowledge from it, idk :)
Report any issues if you see them :P

12 Likes

Updated the documentation on GitHub,
even if you know how to use this, I recommend you give it a full read before using it, and also if you’re not gonna use it, as it shows some of this API’s little quirks, and also some extra info about smaller details.

Could I use this on my plugin? It’s really cool.

  • BTW: I will give you credits :slight_smile:

You can use this library basically however you want to, it’s under the “Unlicense” license, you don’t need credit to do anything, and you can do basically anything you want to.

1 Like

Release - 5.0.0 > 5.2.0

Only changes listed are changes from 5.2.0


An issue with G’Signal and that was an issue with this Signal library as well, as that having a reference to a connection, even if disconnected, leaks the function from it, and could even leak some other connections linked to it. Now disconnected connections’ hidden values are now properly cleaned.
This makes :Fire slightly slower, and :Disconnect can now allocate some memory to a table, in my opnion this is worth the trade-off.

Update 5.2.0 > 5.3.0


You can now use signal names like when they had them!

  • Signal:SetName
  • Signal:GetName
  • Added TOSTRING_ENABLED variable which decides if there is a :__tostring method.

Now when you print a Signal, it won’t print its private contents, but instead "Signal ".. SignalName! Same as Roblox’s ScriptSignals!


Calling Signal.new with a string will automatically set that Signal’s name to that string.

local Event = Signal.new("ClassUpdated")
Event:GetName() -->      "ClassUpdated"

These names are used for debugging, whenever you do something wrong with that signal, it will warn you, and will it warn you telling also which signal it is, using its name.

Update

5.4.1 → 6.0.0


This update is pretty useful!
This update adds types to FastSignal, Signal.Event and Signal.Connection!
If you don’t use type checking, don’t worry. This still is useful.

Having types for both these classes, means that we get overall better auto complete, you don’t need to strictly specify it, but as you can see below, you get extremely rich auto-complete, even outside Roblox-LSP!

This puts it in-front of other Signal libraries in terms of ease of use, and also better similarity to RBXScriptSignals!

There have been also some silent updates since the last update post, but these are mostly internal changes which don’t change much of anything to anyone.

I’m new to type checking, and I only do it for simple stuff like these, if you see any issue or improvement, feel free to open a Pull Request on GitHub, or an issue to point it out.