Skip to content

Releases: AlternativeLua/SuphisSignalModule

v1.0

07 Jul 09:46
79cae04

Choose a tag to compare

Update version 1.0 is now out

  • added Connections property
  • added Connected callback to detect when the signal gets connections
  • improved proxy
  • under the hood changes

Version: 0.5 [BETA]

29 Apr 10:33
5ef155f

Choose a tag to compare

Version: 0.5 [BETA] Pre-release
Pre-release

Update

  • you can now pass custom arguments into Connect, Once and Wait that will be past to the function when called

Version: 0.4 [BETA]

06 Mar 19:43
07024f5

Choose a tag to compare

Version: 0.4 [BETA] Pre-release
Pre-release

SuphisSignalModule

This is not my module it's Suphi#3388 module, join the discord here: https://discord.gg/B3zmjPVBce

Features

  • No Parameter Limitations: Unlike ROBLOX Events there are no parameter limitations
  • Fast: Look at benchmarks below
  • Table Reference: Passing a table will pass a refrence and does not deep clone the table
  • Fire In Order: Events are fired in the same order they where connected in
  • Familiar: Works a lot like RBXScriptSignal and RBXScriptConnection

Benchmarks

Method FastSignal SuphisSignal GoodSignal SimpleSignal RobloxSignal
New 0.2 0.3 0.2 0.1 1.1
Connect 0.5 1.0 0.4 0.3 2.3
Disconnect 0.1 0.5 139.8 3.8 39.0
Fire 2.0 46.8 & 3.7 31.3 104.8 30.6
Wait 3.5 3.5 3.9 5.3 5.4

Download the benchmark ->
https://discord.com/channels/909926338801061961/1042810934277713931/1046079394042609824

microseconds to complete (lower is better)
Fire is the most important benchmark as that's what your going to be doing the most

SuphisSignal vs FastSignal

FastSignal does not create new threads when it fires connections this makes FastSignal fast but if any of the connections use async functions or task.wait() it will block the next connections from fireing until the current connection has finished SuphisSignal has a method called FastFire that works like FastSignal

#SuphisSignal vs Good Signal
SuphisSignal works a lot like GoodSignal but with some small differences

  1. GoodSignal only caches 1 thread where SuphisSignal caches 16 threads it creates
  2. GoodSignal and SuphisSignal both use linked lists but SuphisSignal uses doubly linked list this allows SuphisSignal to disconnect connections without traversing the list
  3. GoodSignal new connections are added to the front of the list making connections fire in reverse order SuphisSignal adds new connections to the end of the list making them fire in the same order as they where connected

Download

Go to release and get the prefered version. or

local signalModule = require(11670710927)

Current Version: Version: 0.4 [BETA]

Constructors

SIGNAL MODULE
new()
Returns a new signal object

Methods

SIGNAL OBJECT

Connect(unc: function)  connection

Connects the given function to the event and returns an connection that represents it

Once(func: function)  connection

Connects the given function to the event (for a single invocation) and returns an connection that represents it

Wait()  Tuple

Yields the current thread until the signal fires and returns the arguments provided by the signal

DisconnectAll()  nil

Disconnects all connections from the signal

Fire(arguments: Tuple)  nil

Fires the event

Properties

CONNECTION OBJECT

Signal  signal/nil  "signal"  READ ONLY

The signal object this connection is connected to or nil

METHODS

Disconnect()  nil

Disconnects the connection from the signal

Simple Example

-- Require the ModuleScript
local signalModule = require(11670710927)

-- create a signal object
local signal = signalModule.new()

-- connect a function to the signal
local connection = signal:Connect(function(...)
  print(...)
end)

-- fire the signal
signal:Fire("Hello world!")

-- Disconnect the connection from the signal
connection:Disconnect()

Disconnect All example

local signalModule = require(11670710927)
local signal = signalModule.new()
signal:Connect(function(...) print("Conection1", ...) end)
signal:Connect(function(...) print("Conection2", ...) end)
signal:Connect(function(...) print("Conection3", ...) end)

signal:Fire("Hello world!")

-- Disconnect all connections from the signal
signal:DisconnectAll()

-- fire the signal again this time nothing will print to output because we disconnected all connections
signal:Fire("Hello world!")

Once Example

local signalModule = require(11670710927)
local signal = signalModule.new()

-- connection a function to only be called once
signal:Once(function(...) print(...) end)

signal:Fire("Hello world!")

-- fire the signal again this time nothing will print to output because once will automatically disconnect once it gets fired
signal:Fire("Hello world!")

Wait Example

local signalModule = require(11670710927)
local signal = signalModule.new()

-- fire after a 10 second delay
task.delay(10, signal.Fire, signal, "Hello world!")

-- wait for the signal to fire then print it
print(signal:Wait())

Version: 0.3 [BETA]

26 Nov 16:08
4e5b724

Choose a tag to compare

Version: 0.3 [BETA] Pre-release
Pre-release

SuphisSignalModule

This is not my module it's Suphi#3388 module, join the discord here: https://discord.gg/B3zmjPVBce

Features

No Parameter Limitations Unlike ROBLOX Events there are no parameter limitations
Fast Look at benchmarks below
Table Reference Passing a table will pass a refrence and does not deep clone the table
Fire In Order Events are fired in the same order they where connected in
Familiar Works a lot like RBXScriptSignal and RBXScriptConnection

        | FastSignal | SuphisSignal | GoodSignal  | SimpleSignal | RobloxSignal |

New

	|  0.2        |  0.5       |  0.2         |  0.1         |  2.8         | 

Connect

	|  1.0        |  1.9       |  0.8         |  0.6         |  5.2         | 

Disconnect

	|  0.2        |  1.2       |  138.3         |  5.7         |  41.5         | 

Fire

	|  6.0        |  49.1      |  46.9        |  113.0       |  34.0      | 

Wait

	|  4.2        |  5.0       |  5.5         |  7.9         |  7.3         | 

microseconds to complete (lower is better)
Fire is the most important benchmark as that's what your going to be doing the most

SuphisSignal vs FastSignal

FastSignal does not create new threads when it fires connections this makes FastSignal fast but if any of the connections use async functions or task.wait() it will block the next connections from fireing until the current connection has finished

#SuphisSignal vs Good Signal
SuphisSignal works a lot like GoodSignal but with some small differences

  1. GoodSignal only caches 1 thread where SuphisSignal caches all threads it creates
  2. GoodSignal and SuphisSignal both use linked lists but SuphisSignal uses doubly linked list this allows SuphisSignal to disconnect connections without traversing the list
  3. GoodSignal new connections are added to the front of the list making connections fire in reverse order SuphisSignal adds new connections to the end of the list making them fire in the same order as they where connected

Download

Go to release and get the prefered version. or

local signalModule = require(11670710927)

Current Version: Version: 0.3 [BETA]

Constructors

new()
Returns a new signal object

Methods

Connect(unc: function)  connection

Connects the given function to the event and returns an connection that represents it

Once(func: function)  connection

Connects the given function to the event (for a single invocation) and returns an connection that represents it

Wait()  Tuple

Yields the current thread until the signal fires and returns the arguments provided by the signal

DisconnectAll()  nil

Disconnects all connections from the signal

Fire(arguments: Tuple)  nil

Fires the event

Properties

Signal  signal/nil  "signal"  READ ONLY

The signal object this connection is connected to or nil

Methods

Disconnect()  nil

Disconnects the connection from the signal

Simple Example

-- Require the ModuleScript
local signalModule = require(11670710927)

-- create a signal object
local signal = signalModule.new()

-- connect a function to the signal
local connection = signal:Connect(function(...)
  print(...)
end)

-- fire the signal
signal:Fire("Hello world!")

-- Disconnect the connection from the signal
connection:Disconnect()

Disconnect All example

local signalModule = require(11670710927)
local signal = signalModule.new()
signal:Connect(function(...) print("Conection1", ...) end)
signal:Connect(function(...) print("Conection2", ...) end)
signal:Connect(function(...) print("Conection3", ...) end)

signal:Fire("Hello world!")

-- Disconnect all connections from the signal
signal:DisconnectAll()

-- fire the signal again this time nothing will print to output because we disconnected all connections
signal:Fire("Hello world!")

Once Example

local signalModule = require(11670710927)
local signal = signalModule.new()

-- connection a function to only be called once
signal:Once(function(...) print(...) end)

signal:Fire("Hello world!")

-- fire the signal again this time nothing will print to output because once will automatically disconnect once it gets fired
signal:Fire("Hello world!")

Wait Example

local signalModule = require(11670710927)
local signal = signalModule.new()

-- fire after a 10 second delay
task.delay(10, signal.Fire, signal, "Hello world!")

-- wait for the signal to fire then print it
print(signal:Wait())

Version: 0.2 [BETA]

18 Nov 16:36
94591a6

Choose a tag to compare

Version: 0.2 [BETA] Pre-release
Pre-release

SuphisSignalModule

This is not my module it's Suphi#3388 module, join the discord here: https://discord.gg/B3zmjPVBce

Features

No Parameter Limitations Unlike ROBLOX Events there are no parameter limitations
Fast Look at benchmarks below
Table Reference Passing a table will pass a refrence and does not deep clone the table
Fire In Order Events are fired in the same order they where connected in
Familiar Works a lot like RBXScriptSignal and RBXScriptConnection

        | FastSignal | GoodSignal | SimpleSignal | SuphisSignal | RobloxSignal |

New

	|  0.1        |  0.5       |  0.2         |  0.3         |  2.6         | 

Connect

	|  0.4        |  0.5       |  1.0         |  0.6         |  3.1         | 

Disconnect

	|  0.2        |  148.5       |  3.8         |  0.9         |  41.7         | 

Fire

	|  4.1        |  48.7       |  114.9         |  18.0         |  34.0         | 

Wait

	|  4.5        |  5.0       |  6.1         |  3.3         |  6.0         | 

microseconds to complete (lower is better)
Fire is the most important benchmark as that's what your going to be doing the most

Download

Go to release and get the prefered version.
Current Version: Version: 0.2 [BETA]

Constructors

new()
Returns a new signal object

Methods

Connect(unc: function)  connection

Connects the given function to the event and returns an connection that represents it

Once(func: function)  connection

Connects the given function to the event (for a single invocation) and returns an connection that represents it

Wait()  Tuple

Yields the current thread until the signal fires and returns the arguments provided by the signal

DisconnectAll()  nil

Disconnects all connections from the signal

Fire(arguments: Tuple)  nil

Fires the event

Properties

Signal  signal/nil  "signal"  READ ONLY

The signal object this connection is connected to or nil

Methods

Disconnect()  nil

Disconnects the connection from the signal

Simple Example

-- Require the ModuleScript
local signalModule = require(game.ServerStorage.SuphisSignalModule)

-- create a signal object
local signal = signalModule.new()

-- connect a function to the signal
local connection = signal:Connect(function(...)
  print(...)
end)

-- fire the signal
signal:Fire("Hello world!")

-- Disconnect the connection from the signal
connection:Disconnect()

Disconnect All example

local signalModule = require(game.ServerStorage.SuphisSignalModule)
local signal = signalModule.new()
signal:Connect(function(...) print("Conection1", ...) end)
signal:Connect(function(...) print("Conection2", ...) end)
signal:Connect(function(...) print("Conection3", ...) end)

signal:Fire("Hello world!")

-- Disconnect all connections from the signal
signal:DisconnectAll()

-- fire the signal again this time nothing will print to output because we disconnected all connections
signal:Fire("Hello world!")

Once Example

local signalModule = require(game.ServerStorage.SuphisSignalModule)
local signal = signalModule.new()

-- connection a function to only be called once
signal:Once(function(...) print(...) end)

signal:Fire("Hello world!")

-- fire the signal again this time nothing will print to output because once will automatically disconnect once it gets fired
signal:Fire("Hello world!")

Wait Example

local signalModule = require(game.ServerScriptService.Classes.DataStore.Signal)
local signal = signalModule.new()

-- fire after a 10 second delay
task.delay(10, signal.Fire, signal, "Hello world!")

-- wait for the signal to fire then print it
print(signal:Wait())

Full Changelog: https://github.com/NameTakenBonk/SuphisSignalModule/commits/Beta