@quenty/instanceutils 6.0.1 → 6.2.0-canary.4096cd9.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 +7 -7
- package/src/Shared/RxInstanceUtils.lua +32 -2
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
|
+
# [6.2.0-canary.4096cd9.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@6.1.0...@quenty/instanceutils@6.2.0-canary.4096cd9.0) (2022-09-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add RxInstanceUtils.observeFirstAncestor ([8723b25](https://github.com/Quenty/NevermoreEngine/commit/8723b258c2590395f4d0eeb971a6a6c0e031a23a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [6.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@6.0.1...@quenty/instanceutils@6.1.0) (2022-08-22)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @quenty/instanceutils
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [6.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@6.0.0...@quenty/instanceutils@6.0.1) (2022-08-16)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @quenty/instanceutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/instanceutils",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.2.0-canary.4096cd9.0",
|
|
4
4
|
"description": "Utility functions involving instances in Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/brio": "
|
|
30
|
-
"@quenty/loader": "
|
|
31
|
-
"@quenty/maid": "
|
|
32
|
-
"@quenty/rx": "
|
|
33
|
-
"@quenty/symbol": "
|
|
29
|
+
"@quenty/brio": "7.2.0-canary.4096cd9.0",
|
|
30
|
+
"@quenty/loader": "5.0.1",
|
|
31
|
+
"@quenty/maid": "2.4.0",
|
|
32
|
+
"@quenty/rx": "6.2.0-canary.4096cd9.0",
|
|
33
|
+
"@quenty/symbol": "2.1.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4096cd94d2c38d382b7aafe8cb2fcb8bb340d051"
|
|
39
39
|
}
|
|
@@ -60,11 +60,11 @@ function RxInstanceUtils.observeAncestry(instance)
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
--[=[
|
|
63
|
-
Observes an instance's ancestry
|
|
63
|
+
Observes an instance's ancestry with a brio
|
|
64
64
|
|
|
65
65
|
@param instance Instance
|
|
66
66
|
@param className string
|
|
67
|
-
@return Observable<Instance
|
|
67
|
+
@return Observable<Brio<Instance>>
|
|
68
68
|
]=]
|
|
69
69
|
function RxInstanceUtils.observeFirstAncestorBrio(instance, className)
|
|
70
70
|
assert(typeof(instance) == "Instance", "Bad instance")
|
|
@@ -97,6 +97,36 @@ function RxInstanceUtils.observeFirstAncestorBrio(instance, className)
|
|
|
97
97
|
end)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
+
--[=[
|
|
101
|
+
Observes an instance's ancestry
|
|
102
|
+
|
|
103
|
+
@param instance Instance
|
|
104
|
+
@param className string
|
|
105
|
+
@return Observable<Instance>
|
|
106
|
+
]=]
|
|
107
|
+
function RxInstanceUtils.observeFirstAncestor(instance, className)
|
|
108
|
+
assert(typeof(instance) == "Instance", "Bad instance")
|
|
109
|
+
assert(type(className) == "string", "Bad className")
|
|
110
|
+
|
|
111
|
+
return Observable.new(function(sub)
|
|
112
|
+
local maid = Maid.new()
|
|
113
|
+
|
|
114
|
+
local lastFound = UNSET_VALUE
|
|
115
|
+
local function handleAncestryChanged()
|
|
116
|
+
local found = instance:FindFirstAncestorWhichIsA(className)
|
|
117
|
+
if found ~= lastFound then
|
|
118
|
+
lastFound = found
|
|
119
|
+
sub:Fire(found)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
maid:GiveTask(instance.AncestryChanged:Connect(handleAncestryChanged))
|
|
124
|
+
handleAncestryChanged()
|
|
125
|
+
|
|
126
|
+
return maid
|
|
127
|
+
end)
|
|
128
|
+
end
|
|
129
|
+
|
|
100
130
|
--[=[
|
|
101
131
|
Returns a brio of the property value
|
|
102
132
|
|