@quenty/tie 10.6.0-canary.490.601c967.0 → 10.7.0

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,16 +3,18 @@
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
- # [10.6.0-canary.490.601c967.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@10.5.0...@quenty/tie@10.6.0-canary.490.601c967.0) (2024-08-27)
6
+ # [10.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@10.6.0...@quenty/tie@10.7.0) (2024-09-12)
7
7
 
8
8
 
9
9
  ### Bug Fixes
10
10
 
11
+ * Tie signal implementation fix ([8dc23bb](https://github.com/Quenty/NevermoreEngine/commit/8dc23bb8300598431a58b273ee2382ee90e76243))
11
12
  * TODO FIX THIS ([3731acd](https://github.com/Quenty/NevermoreEngine/commit/3731acdf4cf888bdac55157670fc61d6a6ba7c3d))
12
13
 
13
14
 
14
15
  ### Features
15
16
 
17
+ * Add tuple package and fix tie signal ([134f90c](https://github.com/Quenty/NevermoreEngine/commit/134f90c03b265b9d2232198475ca27f4d5e87071))
16
18
  * Allow default values to be defined for TiePropertyDefinition ([89112f1](https://github.com/Quenty/NevermoreEngine/commit/89112f15ffdc8c637681ba9f4e7aa1c60e2c7e23))
17
19
  * Unedited all changes ([60e64e3](https://github.com/Quenty/NevermoreEngine/commit/60e64e3efce17c10c4b8965871187d231b338dd4))
18
20
 
@@ -20,6 +22,14 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
20
22
 
21
23
 
22
24
 
25
+ # [10.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@10.5.0...@quenty/tie@10.6.0) (2024-08-09)
26
+
27
+ **Note:** Version bump only for package @quenty/tie
28
+
29
+
30
+
31
+
32
+
23
33
  # [10.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@10.4.0...@quenty/tie@10.5.0) (2024-05-09)
24
34
 
25
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/tie",
3
- "version": "10.6.0-canary.490.601c967.0",
3
+ "version": "10.7.0",
4
4
  "description": "Tie allows interfaces to be defined between Lua OOP and Roblox objects.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,27 +28,28 @@
28
28
  "Quenty"
29
29
  ],
30
30
  "dependencies": {
31
- "@quenty/attributeutils": "14.4.0-canary.490.601c967.0",
32
- "@quenty/baseobject": "10.4.0-canary.490.601c967.0",
33
- "@quenty/brio": "14.4.0-canary.490.601c967.0",
34
- "@quenty/collectionserviceutils": "8.4.0-canary.490.601c967.0",
35
- "@quenty/instanceutils": "13.4.0-canary.490.601c967.0",
36
- "@quenty/loader": "10.4.0-canary.490.601c967.0",
37
- "@quenty/maid": "3.2.0",
38
- "@quenty/rx": "13.4.0-canary.490.601c967.0",
39
- "@quenty/statestack": "14.5.0-canary.490.601c967.0",
40
- "@quenty/string": "3.2.0",
41
- "@quenty/symbol": "3.1.0",
42
- "@quenty/table": "3.5.0",
43
- "@quenty/valuebaseutils": "13.4.0-canary.490.601c967.0",
44
- "@quenty/valueobject": "13.4.0-canary.490.601c967.0"
31
+ "@quenty/attributeutils": "^14.5.0",
32
+ "@quenty/baseobject": "^10.4.0",
33
+ "@quenty/brio": "^14.5.0",
34
+ "@quenty/collectionserviceutils": "^8.5.0",
35
+ "@quenty/instanceutils": "^13.5.0",
36
+ "@quenty/loader": "^10.4.0",
37
+ "@quenty/maid": "^3.3.0",
38
+ "@quenty/rx": "^13.5.0",
39
+ "@quenty/statestack": "^14.6.0",
40
+ "@quenty/string": "^3.2.0",
41
+ "@quenty/symbol": "^3.1.0",
42
+ "@quenty/table": "^3.5.0",
43
+ "@quenty/tuple": "^1.1.0",
44
+ "@quenty/valuebaseutils": "^13.5.0",
45
+ "@quenty/valueobject": "^13.5.0"
45
46
  },
46
47
  "devDependencies": {
47
- "@quenty/promise": "10.4.0-canary.490.601c967.0",
48
- "@quenty/signal": "7.4.0-canary.490.601c967.0"
48
+ "@quenty/promise": "^10.4.0",
49
+ "@quenty/signal": "^7.4.0"
49
50
  },
50
51
  "publishConfig": {
51
52
  "access": "public"
52
53
  },
53
- "gitHead": "601c9671f09638be4f326e41fcfe3343ccfe76d8"
54
+ "gitHead": "fb172906f3ee725269ec1e5f4daf9dca227e729d"
54
55
  }
@@ -7,6 +7,7 @@ local require = require(script.Parent.loader).load(script)
7
7
  local BaseObject = require("BaseObject")
8
8
  local TieUtils = require("TieUtils")
9
9
  local Maid = require("Maid")
10
+ local Tuple = require("Tuple")
10
11
 
11
12
  local TieSignalImplementation = setmetatable({}, BaseObject)
12
13
  TieSignalImplementation.ClassName = "TieSignalImplementation"
@@ -23,12 +24,6 @@ function TieSignalImplementation.new(memberDefinition, implParent, initialValue)
23
24
  self._bindableEvent.Name = memberDefinition:GetMemberName()
24
25
  self._bindableEvent.Parent = self._implParent
25
26
 
26
- -- Abuse the fact that the first signal connected is the first
27
- -- signal to fire!
28
- self._maid:GiveTask(self._bindableEvent.Event:Connect(function()
29
- self._thisIsUsFiring = false
30
- end))
31
-
32
27
  self:SetImplementation(initialValue)
33
28
 
34
29
  return self
@@ -38,17 +33,37 @@ function TieSignalImplementation:SetImplementation(signal)
38
33
  local maid = Maid.new()
39
34
 
40
35
  if type(signal) == "table" then
36
+ -- Prevent re-entrance from stuff fired from ourselves when forwarding events in either direction
37
+ local signalFiredArgs = {}
38
+ local bindableEventFiredArgs = {}
39
+
41
40
  maid:GiveTask(signal:Connect(function(...)
42
- self._thisIsUsFiring = true
41
+ local args = Tuple.new(...)
42
+ for pendingArgs, _ in pairs(signalFiredArgs) do
43
+ if pendingArgs == args then
44
+ -- Remove from queue
45
+ signalFiredArgs[pendingArgs] = nil
46
+ return
47
+ end
48
+ end
49
+
50
+ bindableEventFiredArgs[args] = true
43
51
  self._bindableEvent:Fire(TieUtils.encode(...))
44
52
  end))
45
53
 
46
- -- TODO: Listen to the event and fire off our own event (if we aren't the source).
47
- -- maid:GiveTask(self._bindableEvent.Event:Connect(function(...)
48
- -- if not self._thisIsUsFiring then
49
- -- signal:Fire(TieUtils.decode(...))
50
- -- end
51
- -- end))
54
+ maid:GiveTask(self._bindableEvent.Event:Connect(function(...)
55
+ local args = Tuple.new(TieUtils.decode(...))
56
+ for pendingArgs, _ in pairs(bindableEventFiredArgs) do
57
+ if pendingArgs == args then
58
+ -- Remove from queue
59
+ bindableEventFiredArgs[pendingArgs] = nil
60
+ return
61
+ end
62
+ end
63
+
64
+ signalFiredArgs[args] = true
65
+ signal:Fire(args:Unpack())
66
+ end))
52
67
  end
53
68
 
54
69
  self._maid._implementationMaid = maid
@@ -14,7 +14,10 @@ function TieUtils.encode(...)
14
14
  local results = table.pack(...)
15
15
 
16
16
  for i=1, results.n do
17
- if type(results[i]) == "table" or type(results[i]) == "function" then
17
+ if type(results[i]) == "table"
18
+ or type(results[i]) == "function"
19
+ or typeof(results[i]) == "userdata" then -- newproxy() symbols
20
+
18
21
  local saved = results[i]
19
22
  results[i] = function()
20
23
  return saved -- Pack into a callback so we can transfer data.