Skip to main content

Pulse.Conn

Pulse.Conn replaces the manual "save connection, disconnect before rebinding" pattern. Each name holds exactly one active connection; binding a new one automatically disconnects the previous.


The problem it solves

Without Pulse.Conn, you end up with boilerplate like this in every component:

local _conn = nil
-- Before binding:
if _conn then _conn:Disconnect() end
_conn = RunService.Heartbeat:Connect(fn)
-- On cleanup:
if _conn then _conn:Disconnect() end

With multiple connections this becomes a table of locals you have to track manually.


API

Pulse.Conn.bind("name", connection) -- register; auto-disconnects any previous
Pulse.Conn.disconnect("name") -- disconnect and clear one named connection
Pulse.Conn.disconnectAll() -- disconnect every registered connection

Pulse.Conn is a module-level singleton — all components share the same name registry. Use descriptive names to avoid collisions between components.


Example

defineComponent('ESP', () => {
const enabled = signal(false)

function onHeartbeat() {
const hrp = _PulseGetHRP()
if (!hrp) return
// tracking logic
}

on.signal(enabled, (v) => {
if (v) {
Pulse.Conn.bind('EspLoop', game.GetService('RunService').Heartbeat.Connect(onHeartbeat))
} else {
Pulse.Conn.disconnect('EspLoop')
}
})

return [toggle('Enable ESP').bind(enabled)]
})

In most cases you can use on.heartbeat directly instead — it manages the connection automatically. Use Pulse.Conn when you need conditional rebinding or a raw connection outside the on.* system.


Naming conventions

Prefix names with the component to avoid cross-component collisions:

Pulse.Conn.bind("Aimbot_lock", conn1)
Pulse.Conn.bind("Aimbot_input", conn2)
Pulse.Conn.bind("ESP_heartbeat", conn3)

When to use disconnectAll

Call disconnectAll() in a global cleanup / shutdown handler if you need to tear everything down at once. In normal use, prefer disconnect("name") so unrelated connections stay live.