@rbxts/replion 1.0.13 → 1.0.15
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/README.md +1 -1
- package/package.json +1 -1
- package/src/Server.lua +23 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/src/Server.lua
CHANGED
|
@@ -116,6 +116,25 @@ function Server:observe(path: { string }?, callback: Observer)
|
|
|
116
116
|
return self._signals[signalKey]:Connect(callback);
|
|
117
117
|
end;
|
|
118
118
|
|
|
119
|
+
function Server:_recursiveSignalCheck(currentPath: { string }, updateTree: any)
|
|
120
|
+
for k, v in updateTree do
|
|
121
|
+
local nextPath = table.clone(currentPath);
|
|
122
|
+
table.insert(nextPath, k);
|
|
123
|
+
|
|
124
|
+
local signalKey = Shared.getSignalKey(nextPath);
|
|
125
|
+
local signal = self._signals[signalKey];
|
|
126
|
+
|
|
127
|
+
if signal then
|
|
128
|
+
local newValue = Shared.getNestedValue(self.data, nextPath);
|
|
129
|
+
signal:Fire(newValue, newValue); -- Warning: Sends improper 'old' argument due to shallow copy optimization.
|
|
130
|
+
end;
|
|
131
|
+
|
|
132
|
+
if typeof(v) == 'table' then
|
|
133
|
+
self:_recursiveSignalCheck(nextPath, v);
|
|
134
|
+
end;
|
|
135
|
+
end;
|
|
136
|
+
end;
|
|
137
|
+
|
|
119
138
|
function Server:set(path: { string }, value: any)
|
|
120
139
|
if self._destroyed then return; end;
|
|
121
140
|
|
|
@@ -144,6 +163,10 @@ function Server:set(path: { string }, value: any)
|
|
|
144
163
|
pathSignal:Fire(newValue, oldValue)
|
|
145
164
|
end;
|
|
146
165
|
end;
|
|
166
|
+
|
|
167
|
+
if typeof(newValue) == 'table' then
|
|
168
|
+
self:_recursiveSignalCheck(path, newValue);
|
|
169
|
+
end;
|
|
147
170
|
|
|
148
171
|
local thisUpdate = {};
|
|
149
172
|
setNestedValue(thisUpdate, path, newValue);
|