@quenty/brio 3.5.1-canary.238.2c4d310.0 → 3.5.2
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 +9 -1
- package/README.md +3 -47
- package/package.json +5 -5
- package/src/Shared/Brio.lua +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
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.5.
|
|
6
|
+
## [3.5.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@3.5.1...@quenty/brio@3.5.2) (2021-12-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/brio
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.5.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/brio@3.5.0...@quenty/brio@3.5.1) (2021-12-30)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/brio
|
|
9
17
|
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
## Brio
|
|
2
2
|
<div align="center">
|
|
3
3
|
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
-
<img src="https://
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/mhtGUS8">
|
|
7
7
|
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
@@ -13,53 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
Brios wrap a value and provide the following constraints
|
|
15
15
|
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/Brio">View docs →</a></div>
|
|
17
|
+
|
|
16
18
|
## Installation
|
|
17
19
|
```
|
|
18
20
|
npm install @quenty/brio --save
|
|
19
21
|
```
|
|
20
|
-
|
|
21
|
-
- Can be in 2 states, dead or alive
|
|
22
|
-
- While alive, can retrieve values
|
|
23
|
-
- While dead, retrieving values is forbidden
|
|
24
|
-
- Died will fire once upon death
|
|
25
|
-
|
|
26
|
-
Brios encapsulate the "lifetime" of a valid resource. Unlike a maid, they
|
|
27
|
-
- Can only die once
|
|
28
|
-
- Have less memory leaks
|
|
29
|
-
- Cannot be reentered
|
|
30
|
-
|
|
31
|
-
Calling :Destroy() or :Kill() after death does nothing. Brios cannot be resurrected.
|
|
32
|
-
|
|
33
|
-
Useful for downstream events where you want to emit a resource. Typically
|
|
34
|
-
brios should be killed when their source is killed.
|
|
35
|
-
|
|
36
|
-
Brios are intended to be merged with downstream brios so create a chain of reliable
|
|
37
|
-
resources.
|
|
38
|
-
|
|
39
|
-
Anything may "kill" a brio by calling :Destroy() or :Kill().
|
|
40
|
-
|
|
41
|
-
## Design philosophy
|
|
42
|
-
|
|
43
|
-
Brios are designed to solve this issue where we emit an object with a lifetime associated with it from an Observable stream. This resource is only valid for some amount of time (for example, while the object is in the Roblox data model).
|
|
44
|
-
|
|
45
|
-
In order to know how long we can keep this object/use it, we wrap the object with a Brio, which denotes the lifetime of the object.
|
|
46
|
-
|
|
47
|
-
Modeling this with pure observables is very tricky because the subscriber will have to also monitor/emit a similar object with less clear conventions. For example an observable that emits the object, and then nil on death.
|
|
48
|
-
|
|
49
|
-
## API Surface
|
|
50
|
-
|
|
51
|
-
### `Brio.isBrio(value)`
|
|
52
|
-
|
|
53
|
-
### `Brio.new(...) -- Wrap`
|
|
54
|
-
|
|
55
|
-
### `Brio:GetDiedSignal()`
|
|
56
|
-
|
|
57
|
-
### `Brio:IsDead()`
|
|
58
|
-
|
|
59
|
-
### `Brio:ErrorIfDead()`
|
|
60
|
-
|
|
61
|
-
### `Brio:ToMaid()`
|
|
62
|
-
|
|
63
|
-
### `Brio:GetValue()`
|
|
64
|
-
|
|
65
|
-
### `Brio:Destroy()`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/brio",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
4
4
|
"description": "Brios wrap an object and either are alive or dead",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/loader": "3.1.2
|
|
30
|
-
"@quenty/maid": "2.0.2
|
|
31
|
-
"@quenty/rx": "3.5.
|
|
29
|
+
"@quenty/loader": "^3.1.2",
|
|
30
|
+
"@quenty/maid": "^2.0.2",
|
|
31
|
+
"@quenty/rx": "^3.5.2"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "4afdd64f4ff6bc3b4b4c0ca7a31e839196f2411e"
|
|
37
37
|
}
|
package/src/Shared/Brio.lua
CHANGED
|
@@ -41,6 +41,18 @@
|
|
|
41
41
|
print(brio:GetValue()) --> ERROR: Brio is dead
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
## Design philosophy
|
|
45
|
+
|
|
46
|
+
Brios are designed to solve this issue where we emit an object with a lifetime associated with it from an
|
|
47
|
+
Observable stream. This resource is only valid for some amount of time (for example, while the object is
|
|
48
|
+
in the Roblox data model).
|
|
49
|
+
|
|
50
|
+
In order to know how long we can keep this object/use it, we wrap the object with a Brio, which denotes
|
|
51
|
+
the lifetime of the object.
|
|
52
|
+
|
|
53
|
+
Modeling this with pure observables is very tricky because the subscriber will have to also monitor/emit
|
|
54
|
+
a similar object with less clear conventions. For example an observable that emits the object, and then nil on death.
|
|
55
|
+
|
|
44
56
|
@class Brio
|
|
45
57
|
]=]
|
|
46
58
|
|