@quenty/brio 4.0.0 → 5.1.0-canary.252.9753dcc.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 +19 -0
- package/package.json +5 -6
- package/src/Shared/RxBrioUtils.lua +56 -77
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
# [5.1.0-canary.252.9753dcc.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@5.0.0...@quenty/brio@5.1.0-canary.252.9753dcc.0) (2022-03-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/brio
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [5.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@4.0.0...@quenty/brio@5.0.0) (2022-03-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* Fix circular dependency, move createStateStack from Brio ([9568dd7](https://github.com/Quenty/NevermoreEngine/commit/9568dd78272e487e17e9fb08034a58275838add9))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [4.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@3.8.0...@quenty/brio@4.0.0) (2022-01-17)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @quenty/brio
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/brio",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0-canary.252.9753dcc.0",
|
|
4
4
|
"description": "Brios wrap an object and either are alive or dead",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,13 +26,12 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/loader": "
|
|
30
|
-
"@quenty/maid": "
|
|
31
|
-
"@quenty/rx": "
|
|
32
|
-
"@quenty/statestack": "^4.0.0"
|
|
29
|
+
"@quenty/loader": "4.0.0",
|
|
30
|
+
"@quenty/maid": "2.2.0-canary.252.9753dcc.0",
|
|
31
|
+
"@quenty/rx": "4.1.0-canary.252.9753dcc.0"
|
|
33
32
|
},
|
|
34
33
|
"publishConfig": {
|
|
35
34
|
"access": "public"
|
|
36
35
|
},
|
|
37
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "9753dcc02d4600d2706d8003cebb325ccfcde523"
|
|
38
37
|
}
|
|
@@ -13,7 +13,6 @@ local BrioUtils = require("BrioUtils")
|
|
|
13
13
|
local Maid = require("Maid")
|
|
14
14
|
local Observable = require("Observable")
|
|
15
15
|
local Rx = require("Rx")
|
|
16
|
-
local StateStack= require("StateStack")
|
|
17
16
|
|
|
18
17
|
local RxBrioUtils = {}
|
|
19
18
|
|
|
@@ -32,30 +31,6 @@ function RxBrioUtils.toBrio()
|
|
|
32
31
|
end)
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
--[=[
|
|
36
|
-
Creates a state stack from the brio's value. The state stack holds the last
|
|
37
|
-
value seen that is valid.
|
|
38
|
-
|
|
39
|
-
@param observable Observable<Brio<T>>
|
|
40
|
-
@return StateStack<T>
|
|
41
|
-
]=]
|
|
42
|
-
function RxBrioUtils.createStateStack(observable)
|
|
43
|
-
local stateStack = StateStack.new(nil)
|
|
44
|
-
|
|
45
|
-
stateStack._maid:GiveTask(observable:Subscribe(function(value)
|
|
46
|
-
assert(Brio.isBrio(value), "Observable must emit brio")
|
|
47
|
-
|
|
48
|
-
if value:IsDead() then
|
|
49
|
-
return
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
local maid = value:ToMaid()
|
|
53
|
-
maid:GiveTask(stateStack:PushState(value:GetValue()))
|
|
54
|
-
end))
|
|
55
|
-
|
|
56
|
-
return stateStack
|
|
57
|
-
end
|
|
58
|
-
|
|
59
34
|
--[=[
|
|
60
35
|
Completes the observable on death
|
|
61
36
|
|
|
@@ -141,21 +116,23 @@ function RxBrioUtils.emitWhileAllDead(valueToEmitWhileAllDead)
|
|
|
141
116
|
updateBrios()
|
|
142
117
|
end
|
|
143
118
|
|
|
144
|
-
topMaid:GiveTask(source:Subscribe(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
119
|
+
topMaid:GiveTask(source:Subscribe(
|
|
120
|
+
function(brio)
|
|
121
|
+
if not Brio.isBrio(brio) then
|
|
122
|
+
warn(("[RxBrioUtils.emitWhileAllDead] - Not a brio, %q"):format(tostring(brio)))
|
|
123
|
+
topMaid._lastBrio = nil
|
|
124
|
+
sub:Fail("Not a brio")
|
|
125
|
+
return
|
|
126
|
+
end
|
|
151
127
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
128
|
+
handleNewBrio(brio)
|
|
129
|
+
end,
|
|
130
|
+
function(...)
|
|
131
|
+
sub:Fail(...)
|
|
132
|
+
end,
|
|
133
|
+
function(...)
|
|
134
|
+
sub:Complete(...)
|
|
135
|
+
end))
|
|
159
136
|
|
|
160
137
|
-- Make sure we emit an empty list if we discover nothing
|
|
161
138
|
if not fired then
|
|
@@ -235,22 +212,23 @@ function RxBrioUtils.reduceToAliveList(selectFromBrio)
|
|
|
235
212
|
updateBrios()
|
|
236
213
|
end
|
|
237
214
|
|
|
238
|
-
topMaid:GiveTask(source:Subscribe(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
215
|
+
topMaid:GiveTask(source:Subscribe(
|
|
216
|
+
function(brio)
|
|
217
|
+
if not Brio.isBrio(brio) then
|
|
218
|
+
warn(("[RxBrioUtils.mergeToAliveList] - Not a brio, %q"):format(tostring(brio)))
|
|
219
|
+
topMaid._lastBrio = nil
|
|
220
|
+
sub:Fail("Not a brio")
|
|
221
|
+
return
|
|
222
|
+
end
|
|
245
223
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
224
|
+
handleNewBrio(brio)
|
|
225
|
+
end,
|
|
226
|
+
function(...)
|
|
227
|
+
sub:Fail(...)
|
|
228
|
+
end,
|
|
229
|
+
function(...)
|
|
230
|
+
sub:Complete(...)
|
|
231
|
+
end))
|
|
254
232
|
|
|
255
233
|
-- Make sure we emit an empty list if we discover nothing
|
|
256
234
|
if not fired then
|
|
@@ -272,33 +250,34 @@ function RxBrioUtils.reemitLastBrioOnDeath()
|
|
|
272
250
|
return Observable.new(function(sub)
|
|
273
251
|
local maid = Maid.new()
|
|
274
252
|
|
|
275
|
-
maid:GiveTask(source:Subscribe(
|
|
276
|
-
|
|
253
|
+
maid:GiveTask(source:Subscribe(
|
|
254
|
+
function(brio)
|
|
255
|
+
maid._conn = nil
|
|
277
256
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
257
|
+
if not Brio.isBrio(brio) then
|
|
258
|
+
warn(("[RxBrioUtils.reemitLastBrioOnDeath] - Not a brio, %q"):format(tostring(brio)))
|
|
259
|
+
sub:Fail("Not a brio")
|
|
260
|
+
return
|
|
261
|
+
end
|
|
283
262
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
263
|
+
if brio:IsDead() then
|
|
264
|
+
sub:Fire(brio)
|
|
265
|
+
return
|
|
266
|
+
end
|
|
288
267
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
268
|
+
-- Setup conn!
|
|
269
|
+
maid._conn = brio:GetDiedSignal():Connect(function()
|
|
270
|
+
sub:Fire(brio)
|
|
271
|
+
end)
|
|
293
272
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
273
|
+
sub:Fire(brio)
|
|
274
|
+
end,
|
|
275
|
+
function(...)
|
|
276
|
+
sub:Fail(...)
|
|
277
|
+
end,
|
|
278
|
+
function(...)
|
|
279
|
+
sub:Complete(...)
|
|
280
|
+
end))
|
|
302
281
|
|
|
303
282
|
return maid
|
|
304
283
|
end)
|