Hello Developers!
This module provides a Dynamic Event Listener System that makes it easy and fast to handle events in your projects. It helps you add and remove event listeners smoothly, while also optimizing performance.
Key Features:
- Easy to add listeners to events with unique IDs.
- Fast event handling with minimal performance impact.
- Optimized for handling multiple listeners efficiently.
- Remove listener(s) from an event easily.
Example Usage:
local RunService = game:GetService("RunService")
local Listener = require(ListenerModule_Path)
-- Adding a listener to the Heartbeat event
Listener:AddListener(RunService.Heartbeat, "HeartbeatHandler", function(deltaTime)
print("Heartbeat triggered. Delta Time:", deltaTime)
end)
--Add multiple listeners to same event.
Listener:AddListener(RunService.Heartbeat, "SecondHeartbeatHandler", function(deltaTime)
print("Second Heartbeat triggered. Delta Time:", deltaTime)
end)
-- Removing a specific listener by ID
Listener:RemoveListener(RunService.Heartbeat, "HeartbeatHandler")
-- Removing all listeners from the Heartbeat event (no ID needed)
Listener:RemoveListener(RunService.Heartbeat)
Support:
If you have any questions about integrating this module into your project, feel free to leave a comment!
To get Listener module on library: Listener