@quenty/signal 7.11.1 → 7.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.11.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/signal@7.11.1...@quenty/signal@7.11.2) (2025-12-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Update typing to be more accurate ([e4c3d05](https://github.com/Quenty/NevermoreEngine/commit/e4c3d05a0aa9f45a37cbfa372c5e0d8a748c9323))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [7.11.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/signal@7.11.0...@quenty/signal@7.11.1) (2025-08-12)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/signal",
3
- "version": "7.11.1",
3
+ "version": "7.11.2",
4
4
  "description": "A simple signal implementation for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -32,5 +32,5 @@
32
32
  "dependencies": {
33
33
  "@quenty/loader": "^10.9.0"
34
34
  },
35
- "gitHead": "847e9e65e518392c1e2f30669ee2589ed3d7e870"
35
+ "gitHead": "e4614dfea3bf2580ec2b10552c311b273ed1387c"
36
36
  }
@@ -48,7 +48,11 @@ local require = require(script.Parent.loader).load(script)
48
48
 
49
49
  local EventHandlerUtils = require("EventHandlerUtils")
50
50
 
51
- -- Connection class
51
+ --[=[
52
+ A connection to a signal.
53
+
54
+ @class Connection
55
+ ]=]
52
56
  local Connection = {}
53
57
  Connection.ClassName = "Connection"
54
58
  Connection.__index = Connection
@@ -64,6 +68,13 @@ export type Connection<T...> = typeof(setmetatable(
64
68
  {} :: typeof({ __index = Connection })
65
69
  ))
66
70
 
71
+ --[=[
72
+ Constructs a new connection object. Not useful directly, use Signal:Connect instead.
73
+
74
+ @param signal Signal<T...> -- The signal this connection is connected to
75
+ @param fn (... T) -> () -- The function handler for this connection
76
+ @return Connection
77
+ ]=]
67
78
  function Connection.new<T...>(signal: Signal<T...>, fn: SignalHandler<T...>): Connection<T...>
68
79
  return setmetatable({
69
80
  -- selene: allow(incorrect_standard_library_use)
@@ -73,10 +84,22 @@ function Connection.new<T...>(signal: Signal<T...>, fn: SignalHandler<T...>): Co
73
84
  }, Connection) :: any
74
85
  end
75
86
 
87
+ --[=[
88
+ Returns whether the connection is still connected.
89
+
90
+ @within Connection
91
+ @return boolean
92
+ ]=]
76
93
  function Connection.IsConnected<T...>(self: Connection<T...>): boolean
77
94
  return rawget(self :: any, "_signal") ~= nil
78
95
  end
79
96
 
97
+ --[=[
98
+ Disconnects the connection from the signal.
99
+
100
+ @within Connection
101
+ @return ()
102
+ ]=]
80
103
  function Connection.Disconnect<T...>(self: Connection<T...>)
81
104
  local signal = rawget(self :: any, "_signal")
82
105
  if not signal then
@@ -109,6 +132,12 @@ function Connection.Disconnect<T...>(self: Connection<T...>)
109
132
  table.clear(self :: any)
110
133
  end
111
134
 
135
+ --[=[
136
+ Alias for [Disconnect]
137
+
138
+ @function Destroy
139
+ @within Connection
140
+ ]=]
112
141
  Connection.Destroy = Connection.Disconnect
113
142
 
114
143
  -- Make signal strict
@@ -170,9 +199,14 @@ function Signal.Connect<T...>(self: Signal<T...>, fn: SignalHandler<T...>): Conn
170
199
  return connection
171
200
  end
172
201
 
173
- function Signal:GetConnectionCount()
202
+ --[=[
203
+ Returns the number of connected handlers to the signal.
204
+
205
+ @return number
206
+ ]=]
207
+ function Signal.GetConnectionCount<T...>(self: Signal<T...>): number
174
208
  local n = 0
175
- local prev = self._handlerListHead
209
+ local prev: any = self._handlerListHead
176
210
  while prev do
177
211
  n += 1
178
212
  prev = rawget(prev, "_next")