@rbxts/replion 1.0.16 → 1.0.17
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 +2 -6
- package/src/Client.lua +4 -1
- package/src/Server.lua +4 -1
- package/src/index.d.ts +4 -4
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rbxts/replion",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/init.lua",
|
|
6
6
|
"scripts": {},
|
|
@@ -20,9 +20,5 @@
|
|
|
20
20
|
"@rbxts/types": "^1.0.896",
|
|
21
21
|
"roblox-ts": "^3.0.0",
|
|
22
22
|
"typescript": "^5.9.3"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@rbxts/sift": "^0.0.11",
|
|
26
|
-
"@rbxts/sleitnick-signal": "^1.0.8"
|
|
27
23
|
}
|
|
28
|
-
}
|
|
24
|
+
}
|
package/src/Client.lua
CHANGED
|
@@ -78,7 +78,10 @@ function Client:observe(path: { string }?, callback: Observer)
|
|
|
78
78
|
local initialValue = Shared.getNestedValue(self.data, path);
|
|
79
79
|
|
|
80
80
|
task.spawn(callback, initialValue, nil);
|
|
81
|
-
|
|
81
|
+
local connection = self._signals[signalKey]:Connect(callback);
|
|
82
|
+
return function()
|
|
83
|
+
connection:Disconnect();
|
|
84
|
+
end;
|
|
82
85
|
end;
|
|
83
86
|
|
|
84
87
|
function Client:_collectDeletions(target: any, updates: any, path: { string }, out: { Deletion })
|
package/src/Server.lua
CHANGED
|
@@ -113,7 +113,10 @@ function Server:observe(path: { string }?, callback: Observer)
|
|
|
113
113
|
local initialValue = Shared.getNestedValue(self.data, path);
|
|
114
114
|
|
|
115
115
|
task.spawn(callback, initialValue, nil);
|
|
116
|
-
|
|
116
|
+
local connection = self._signals[signalKey]:Connect(callback);
|
|
117
|
+
return function()
|
|
118
|
+
connection:Disconnect();
|
|
119
|
+
end;
|
|
117
120
|
end;
|
|
118
121
|
|
|
119
122
|
function Server:_notifyDeep(currentPath: { string }, newValue: any, oldValue: any)
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Connection } from '@rbxts/sleitnick-signal';
|
|
2
|
-
|
|
3
1
|
declare namespace Replion {
|
|
4
2
|
/**
|
|
5
3
|
* Recursively builds a union of all valid path tuples for object T.
|
|
@@ -20,6 +18,8 @@ declare namespace Replion {
|
|
|
20
18
|
: never
|
|
21
19
|
: never;
|
|
22
20
|
|
|
21
|
+
type Cleanup = () => void;
|
|
22
|
+
|
|
23
23
|
interface ServerConfig<T extends object> {
|
|
24
24
|
channel: string;
|
|
25
25
|
replicateTo?: Player;
|
|
@@ -30,11 +30,11 @@ declare namespace Replion {
|
|
|
30
30
|
get(): T;
|
|
31
31
|
get<P extends Path<T>>(path: P): PathValue<T, P>;
|
|
32
32
|
|
|
33
|
-
observe(key: undefined, callback: (newValue: T, oldValue: Partial<T>) => void):
|
|
33
|
+
observe(key: undefined, callback: (newValue: T, oldValue: Partial<T>) => void): Cleanup;
|
|
34
34
|
observe<P extends Path<T>>(
|
|
35
35
|
path: P,
|
|
36
36
|
callback: (newValue: PathValue<T, P>, oldValue: PathValue<T, P> | undefined) => void,
|
|
37
|
-
):
|
|
37
|
+
): Cleanup;
|
|
38
38
|
|
|
39
39
|
destroy(): void;
|
|
40
40
|
}
|