Connector
An in-house module created for expanding the features of roblox signals and connections.
Features
- Priority based callback firing
- Condition based callback firing
- Overriding existing connections
- Ignoring default and passing additional arguments to callback
API
Types
ConnectOptions
type ConnectOptions = {
Priority: number?,
Condition: any?,
OverrideExisting: boolean?,
IgnoreSignalArguments: boolean?,
}
Priority - The higher it is, the later the callback is called. Use an Enum as a reference value.
Condition - The condition of the first argument needs to meet for the callback to be fired.
OverrideExisting - Whether the previous connection to this even should be overridden.
IgnoreSignalArguments - Skips the parameters passed by the signal.
Methods
.Connect()
Connects a RBXScriptSignal or a Signal from the Signal library to a callback function.
Connector.Connect<sA, aA>(
signal: RBXScriptSignal,
callbackFunction: (sA, aA...) -> (any),
options: ConnectOptions?,
...: aA...
)
.Once()
Same as .Connect(), just disconnects the connection after the first event firing.
Connector.Once<sA, aA>(
signal: RBXScriptSignal,
callbackFunction: (sA, aA...) -> (any),
options: ConnectOptions,
...: aA...
)
Enums
Constant values usable for config. They can be accessed in the Enum field of Connector module.
DefaultPriority - Default priority all signals use, you can modify the priority by adding or subtracting from it.
GameStartPriority - Unused by default.