Forest Logo
search
package_2

advancedsignal

By @dervexhero

Roblox

Mirrored

Advanced Signal

Advanced Signal lets you choose whether you prefer performance or ease of use

About

Signal is not yieldable by default, so yielding inside one of its bindings will result in yielding rest of them. By default, the binding order is not preserved thus connection that were made first will be fired last. Behavior of these two things can be changed by providing additional arguments to Signal.new() or by changing globally DEFAULT_SETTINGS.

API Usage

local Signal = require(path.to.advancedsignal.module)

-- Creates new signal class with optional settings
local signal = Signal.new(yieldable?, keepOrder?)

-- Binds callback to the signal, returns connection
local handle = signal:Bind(function(params)
	print(params)
end)

-- Binds callback to the signal, will unbind automatically, returns connection
signal:Once(function(params)
	print(params)
end)

-- Fires signal with given arguments
signal:Fire(args)

-- Unbinds a connection from the signal
handle:Unbind() or signal:Unbind(handle)

-- Unbinds all connections from the signal
signal:UnbindAll()

-- Yields current thread until signal is fired
signal:Wait()

Credits

Part of this code was written by @stravant

Package Details

Install command (Click to copy)


Version

1.0.1

License

Apache-2.0

check_circle

Safe for commercial use

infoModified files must carry a notice of changes. If the package ships a NOTICE file, its attributions must be preserved.

Automated license review — not legal advice.