@quenty/instanceutils 4.1.1-canary.256.edbbcfc.0 → 5.0.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,7 +3,18 @@
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
- ## [4.1.1-canary.256.edbbcfc.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@4.1.0...@quenty/instanceutils@4.1.1-canary.256.edbbcfc.0) (2022-03-27)
6
+ # [5.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@4.2.0...@quenty/instanceutils@5.0.0) (2022-05-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add RxInstanceUtils.observeFirstAncestorBrio(instance, className) ([c3ea0a7](https://github.com/Quenty/NevermoreEngine/commit/c3ea0a7c833eef97ab8ed86e8d3c7a35cbcd270b))
12
+
13
+
14
+
15
+
16
+
17
+ # [4.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@4.1.0...@quenty/instanceutils@4.2.0) (2022-03-27)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/instanceutils
9
20
 
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2021 Quenty
3
+ Copyright (c) 2014-2022 Quenty
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/instanceutils",
3
- "version": "4.1.1-canary.256.edbbcfc.0",
3
+ "version": "5.0.0",
4
4
  "description": "Utility functions involving instances in Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,13 +26,13 @@
26
26
  "Quenty"
27
27
  ],
28
28
  "dependencies": {
29
- "@quenty/brio": "5.1.1-canary.256.edbbcfc.0",
30
- "@quenty/loader": "4.0.1-canary.256.edbbcfc.0",
31
- "@quenty/maid": "2.2.1-canary.256.edbbcfc.0",
32
- "@quenty/rx": "4.1.1-canary.256.edbbcfc.0"
29
+ "@quenty/brio": "^6.0.0",
30
+ "@quenty/loader": "^5.0.0",
31
+ "@quenty/maid": "^2.3.0",
32
+ "@quenty/rx": "^5.0.0"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "edbbcfc38516772a791d50dc43cd6b304ffc4aff"
37
+ "gitHead": "9f7eaea7543c33c89d2e32c38491b13f9271f4f7"
38
38
  }
@@ -56,6 +56,44 @@ function RxInstanceUtils.observeAncestry(instance)
56
56
  return startWithParent(Rx.fromSignal(instance.AncestryChanged))
57
57
  end
58
58
 
59
+ --[=[
60
+ Observes an instance's ancestry
61
+
62
+ @param instance Instance
63
+ @param className string
64
+ @return Observable<Instance>
65
+ ]=]
66
+ function RxInstanceUtils.observeFirstAncestorBrio(instance, className)
67
+ assert(typeof(instance) == "Instance", "Bad instance")
68
+ assert(type(className) == "string", "Bad className")
69
+
70
+ return Observable.new(function(sub)
71
+ local maid = Maid.new()
72
+
73
+ local lastFound = nil
74
+ local function handleAncestryChanged()
75
+ local found = instance:FindFirstAncestorWhichIsA(className)
76
+
77
+ if found then
78
+ if found ~= lastFound then
79
+ lastFound = found
80
+ local brio = Brio.new(found)
81
+ maid._current = brio
82
+ sub:Fire(brio)
83
+ end
84
+ elseif lastFound then
85
+ maid._current = nil
86
+ lastFound = nil
87
+ end
88
+ end
89
+
90
+ maid:GiveTask(instance.AncestryChanged:Connect(handleAncestryChanged))
91
+ handleAncestryChanged()
92
+
93
+ return maid
94
+ end)
95
+ end
96
+
59
97
  --[=[
60
98
  Returns a brio of the property value
61
99