@quenty/brio 3.6.0 → 3.6.1-canary.244.f59530a.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,6 +3,17 @@
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
+ ## [3.6.1-canary.244.f59530a.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@3.6.0...@quenty/brio@3.6.1-canary.244.f59530a.0) (2022-01-07)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add RxBrioUtils.createStateStack(observable) ([27c95e3](https://github.com/Quenty/NevermoreEngine/commit/27c95e3bee3a248d1aa10aed370f85cfd8153372))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@3.5.2...@quenty/brio@3.6.0) (2022-01-03)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/brio",
3
- "version": "3.6.0",
3
+ "version": "3.6.1-canary.244.f59530a.0",
4
4
  "description": "Brios wrap an object and either are alive or dead",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,12 +26,13 @@
26
26
  "Quenty"
27
27
  ],
28
28
  "dependencies": {
29
- "@quenty/loader": "^3.2.0",
30
- "@quenty/maid": "^2.0.2",
31
- "@quenty/rx": "^3.6.0"
29
+ "@quenty/loader": "3.2.1-canary.244.f59530a.0",
30
+ "@quenty/maid": "2.0.2",
31
+ "@quenty/rx": "3.6.1-canary.244.f59530a.0",
32
+ "@quenty/statestack": "3.3.1-canary.244.f59530a.0"
32
33
  },
33
34
  "publishConfig": {
34
35
  "access": "public"
35
36
  },
36
- "gitHead": "d910da8f5c7e9a55a8bf76d8efbe5632713dd0fe"
37
+ "gitHead": "f59530a0cbadcb30e6f11f15aea08e0641200078"
37
38
  }
@@ -13,6 +13,7 @@ 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")
16
17
 
17
18
  local RxBrioUtils = {}
18
19
 
@@ -31,6 +32,30 @@ function RxBrioUtils.toBrio()
31
32
  end)
32
33
  end
33
34
 
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()
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
+
34
59
  --[=[
35
60
  Completes the observable on death
36
61