@quenty/collectionserviceutils 2.1.0 → 2.2.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
+ # [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/collectionserviceutils@2.1.0...@quenty/collectionserviceutils@2.2.0) (2022-11-19)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add RxCollectionServiceUtils.observeTaggedBrio(tagName) ([08b72a3](https://github.com/Quenty/NevermoreEngine/commit/08b72a3b8a451f0251c76fbe939ed177dafd71f9))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/collectionserviceutils@2.0.1...@quenty/collectionserviceutils@2.1.0) (2022-03-27)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/collectionserviceutils
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/collectionserviceutils",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Utility functions for use with collection service tags",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -20,6 +20,11 @@
20
20
  "type": "patreon",
21
21
  "url": "https://www.patreon.com/quenty"
22
22
  },
23
+ "dependencies": {
24
+ "@quenty/brio": "^8.1.1",
25
+ "@quenty/loader": "^6.0.1",
26
+ "@quenty/rx": "^7.1.1"
27
+ },
23
28
  "license": "MIT",
24
29
  "contributors": [
25
30
  "Quenty"
@@ -27,5 +32,5 @@
27
32
  "publishConfig": {
28
33
  "access": "public"
29
34
  },
30
- "gitHead": "501844bd6c3d3f765fd3032b997d8030bc963a1f"
35
+ "gitHead": "2114f42ae399a4417a3ebd4d35bf481690ca7923"
31
36
  }
@@ -0,0 +1,46 @@
1
+ --[=[
2
+ @class RxCollectionServiceUtils
3
+ ]=]
4
+
5
+ local require = require(script.Parent.loader).load(script)
6
+
7
+ local CollectionService = game:GetService("CollectionService")
8
+
9
+ local Observable = require("Observable")
10
+ local Maid = require("Maid")
11
+ local Brio = require("Brio")
12
+
13
+ local RxCollectionServiceUtils = {}
14
+
15
+ --[=[
16
+ Observes tagged instances
17
+
18
+ @param tagName string
19
+ @return Observable<Brio<Instance>>
20
+ ]=]
21
+ function RxCollectionServiceUtils.observeTaggedBrio(tagName)
22
+ assert(type(tagName) == "string", "Bad tagName")
23
+
24
+ return Observable.new(function(sub)
25
+ local maid = Maid.new()
26
+
27
+ local function handleItemAdded(inst)
28
+ local brio = Brio.new(inst)
29
+ maid[inst] = brio
30
+ sub:Fire(brio)
31
+ end
32
+
33
+ maid:GiveTask(CollectionService:GetInstanceAddedSignal(tagName):Connect(handleItemAdded))
34
+ maid:GiveTask(CollectionService:GetInstanceRemovedSignal(tagName):Connect(function(inst)
35
+ maid[inst] = nil
36
+ end))
37
+
38
+ for _, inst in pairs(CollectionService:GetTagged(tagName)) do
39
+ task.spawn(handleItemAdded, inst)
40
+ end
41
+
42
+ return maid
43
+ end)
44
+ end
45
+
46
+ return RxCollectionServiceUtils
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "node_modules",
3
+ "globIgnorePaths": [ "**/.package-lock.json" ],
4
+ "tree": {
5
+ "$path": { "optional": "../node_modules" }
6
+ }
7
+ }