@bazir/utils 0.1.2 → 0.1.7
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/out/Network.luau +11 -8
- package/package.json +10 -9
package/out/Network.luau
CHANGED
|
@@ -6,9 +6,9 @@ local createError = _Error.createError
|
|
|
6
6
|
local _Platform = TS.import(script, TS.getModule(script, "@bazir", "core").out.Platform)
|
|
7
7
|
local getDebugInfo = _Platform.getDebugInfo
|
|
8
8
|
local isRunningOnServer = _Platform.isRunningOnServer
|
|
9
|
+
local connect = TS.import(script, TS.getModule(script, "@bazir", "core").out.Signal).connect
|
|
9
10
|
local _State = TS.import(script, TS.getModule(script, "@bazir", "state").out.State)
|
|
10
|
-
local
|
|
11
|
-
local subscribe = _State.subscribe
|
|
11
|
+
local createState = _State.createState
|
|
12
12
|
local peek = _State.peek
|
|
13
13
|
local update = _State.update
|
|
14
14
|
local write = _State.write
|
|
@@ -237,15 +237,18 @@ do
|
|
|
237
237
|
end
|
|
238
238
|
local connectPatches = createEvent(level + 1)
|
|
239
239
|
local applyPatches = createEvent(level + 1)
|
|
240
|
-
local state =
|
|
240
|
+
local state = createState(initialValue)
|
|
241
241
|
if isRunningOnServer() then
|
|
242
242
|
local activePlayers = {}
|
|
243
243
|
Players.PlayerRemoving:Connect(function(player)
|
|
244
244
|
local _player = player
|
|
245
245
|
activePlayers[_player] = nil
|
|
246
246
|
end)
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
local lastValue
|
|
248
|
+
connect(state, function()
|
|
249
|
+
local newValue = peek(state)
|
|
250
|
+
lastValue = newValue
|
|
251
|
+
local patches = diff(lastValue, newValue)
|
|
249
252
|
if patches == nil then
|
|
250
253
|
return nil
|
|
251
254
|
end
|
|
@@ -280,7 +283,7 @@ do
|
|
|
280
283
|
end
|
|
281
284
|
local connectPatches = createEvent(level + 1)
|
|
282
285
|
local applyPatches = createEvent(level + 1)
|
|
283
|
-
local state =
|
|
286
|
+
local state = createState(initialValue)
|
|
284
287
|
if isRunningOnServer() then
|
|
285
288
|
state[SECRET] = {
|
|
286
289
|
active = {},
|
|
@@ -403,8 +406,8 @@ do
|
|
|
403
406
|
if isRunningOnServer() then
|
|
404
407
|
error("useAction can only be called on the client")
|
|
405
408
|
end
|
|
406
|
-
local pending =
|
|
407
|
-
local errorMessage =
|
|
409
|
+
local pending = createState(false)
|
|
410
|
+
local errorMessage = createState(nil)
|
|
408
411
|
local actionCaller = TS.async(function(...)
|
|
409
412
|
local args = { ... }
|
|
410
413
|
write(pending, true)
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bazir/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Utility functions for Bazir framework",
|
|
5
5
|
"main": "out/init.lua",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rbxtsc",
|
|
9
|
+
"watch": "rbxtsc -w",
|
|
10
|
+
"prepublishOnly": "pnpm run build"
|
|
11
|
+
},
|
|
7
12
|
"files": [
|
|
8
13
|
"out",
|
|
9
14
|
"!**/*.tsbuildinfo"
|
|
@@ -21,18 +26,14 @@
|
|
|
21
26
|
"author": "",
|
|
22
27
|
"license": "ISC",
|
|
23
28
|
"dependencies": {
|
|
24
|
-
"@bazir/core": "^0.1.
|
|
25
|
-
"@bazir/state": "^0.1.
|
|
26
|
-
"@bazir/ui": "^0.1.
|
|
29
|
+
"@bazir/core": "^0.1.6",
|
|
30
|
+
"@bazir/state": "^0.1.7",
|
|
31
|
+
"@bazir/ui": "^0.1.7",
|
|
27
32
|
"@rbxts/services": "^1.5.5"
|
|
28
33
|
},
|
|
29
34
|
"devDependencies": {
|
|
30
35
|
"@rbxts/compiler-types": "3.0.0-types.0",
|
|
31
|
-
"@rbxts/types": "^1.0.
|
|
36
|
+
"@rbxts/types": "^1.0.841",
|
|
32
37
|
"typescript": "^5.8.2"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "rbxtsc",
|
|
36
|
-
"watch": "rbxtsc -w"
|
|
37
38
|
}
|
|
38
39
|
}
|