@quenty/brio 8.17.0 → 8.18.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,22 @@
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
+ # [8.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@8.17.0...@quenty/brio@8.18.0) (2023-09-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add versions to package ([104323f](https://github.com/Quenty/NevermoreEngine/commit/104323fb7f53b866282b2cdef9bf8a849cfb308c))
12
+
13
+
14
+ ### Features
15
+
16
+ * Use GoodSignal and add :ToMaidAndValue helper method ([7dd9196](https://github.com/Quenty/NevermoreEngine/commit/7dd91960cc06977c6a13784d3109123b259010a5))
17
+
18
+
19
+
20
+
21
+
6
22
  # [8.17.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@8.16.0...@quenty/brio@8.17.0) (2023-08-23)
7
23
 
8
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/brio",
3
- "version": "8.17.0",
3
+ "version": "8.18.0",
4
4
  "description": "Brios wrap an object and either are alive or dead",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,10 +28,12 @@
28
28
  "dependencies": {
29
29
  "@quenty/loader": "^6.3.0",
30
30
  "@quenty/maid": "^2.6.0",
31
- "@quenty/rx": "^7.15.0"
31
+ "@quenty/rx": "^7.15.0",
32
+ "@quenty/signal": "^2.4.0",
33
+ "@quenty/steputils": "^3.3.0"
32
34
  },
33
35
  "publishConfig": {
34
36
  "access": "public"
35
37
  },
36
- "gitHead": "3b7e47e2180964b6b0b156d07814810e063ef7ed"
38
+ "gitHead": "fa0826fa54fabecb242d7c0753e2e7644ba02e11"
37
39
  }
@@ -59,6 +59,7 @@
59
59
  local require = require(script.Parent.loader).load(script)
60
60
 
61
61
  local Maid = require("Maid")
62
+ local GoodSignal = require("GoodSignal")
62
63
 
63
64
  local Brio = {}
64
65
  Brio.ClassName = "Brio"
@@ -136,11 +137,11 @@ function Brio:GetDiedSignal()
136
137
  end
137
138
 
138
139
  if self._diedEvent then
139
- return self._diedEvent.Event
140
+ return self._diedEvent
140
141
  end
141
142
 
142
- self._diedEvent = Instance.new("BindableEvent")
143
- return self._diedEvent.Event
143
+ self._diedEvent = GoodSignal.new()
144
+ return self._diedEvent
144
145
  end
145
146
 
146
147
  --[=[
@@ -205,6 +206,10 @@ function Brio:ToMaid()
205
206
  return maid
206
207
  end
207
208
 
209
+ function Brio:ToMaidAndValue()
210
+ return self:ToMaid(), self:GetValue()
211
+ end
212
+
208
213
  --[=[
209
214
  If the brio is not dead, will return the values unpacked from the brio.
210
215
 
@@ -699,7 +699,9 @@ end
699
699
  @return (source: Observable<Brio<T> | T>) -> Observable<T | U>
700
700
  ]=]
701
701
  function RxBrioUtils.emitOnDeath(emitOnDeathValue)
702
- return Rx.switchMap(RxBrioUtils.mapBrioToEmitOnDeathObservable(emitOnDeathValue));
702
+ return Rx.switchMap(function(brio)
703
+ return RxBrioUtils.toEmitOnDeathObservable(brio, emitOnDeathValue)
704
+ end);
703
705
  end
704
706
 
705
707
  --[=[
@@ -63,18 +63,17 @@ return function()
63
63
  local lastResult = nil
64
64
  local fireCount = 0
65
65
 
66
+ local sub = observe:Subscribe(function(result)
67
+ lastResult = result
68
+ fireCount = fireCount + 1
69
+ end)
70
+
66
71
  it("should execute immediately", function()
67
- local sub = observe:Subscribe(function(result)
68
- lastResult = result
69
- fireCount = fireCount + 1
70
- end)
71
72
  expect(fireCount).to.equal(1)
72
73
  expect(lastResult).to.be.a("table")
73
74
  expect(Brio.isBrio(lastResult)).to.equal(false)
74
75
  expect(lastResult.value).to.equal(5)
75
76
  expect(lastResult.otherValue).to.equal(25)
76
-
77
- sub:Destroy()
78
77
  end)
79
78
 
80
79
  it("should reset when the brio is killed", function()
@@ -112,5 +111,9 @@ return function()
112
111
  expect(lastResult.value).to.equal(75)
113
112
  expect(lastResult.otherValue).to.equal(25)
114
113
  end)
114
+
115
+ it("should cleanup the sub", function()
116
+ sub:Destroy()
117
+ end)
115
118
  end)
116
119
  end