@quenty/rx 5.1.0 → 5.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 +11 -0
- package/package.json +5 -5
- package/src/Shared/Rx.lua +38 -0
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
|
+
# [5.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rx@5.1.0...@quenty/rx@5.2.0) (2022-07-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add Rx.timer() method ([36378c1](https://github.com/Quenty/NevermoreEngine/commit/36378c1d7fc4948d3e455a6bca487bc3552a5a6c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [5.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rx@5.0.0...@quenty/rx@5.1.0) (2022-06-21)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/rx",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Quenty's reactive library for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@quenty/cancellabledelay": "^3.3.0",
|
|
31
|
-
"@quenty/canceltoken": "^5.
|
|
31
|
+
"@quenty/canceltoken": "^5.1.0",
|
|
32
32
|
"@quenty/loader": "^5.0.0",
|
|
33
|
-
"@quenty/maid": "^2.
|
|
34
|
-
"@quenty/promise": "^5.
|
|
33
|
+
"@quenty/maid": "^2.4.0",
|
|
34
|
+
"@quenty/promise": "^5.1.0",
|
|
35
35
|
"@quenty/signal": "^2.2.0",
|
|
36
36
|
"@quenty/symbol": "^2.1.0",
|
|
37
37
|
"@quenty/table": "^3.1.0",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "e31b3a35aa475bb5699a24898a8639e107165b36"
|
|
44
44
|
}
|
package/src/Shared/Rx.lua
CHANGED
|
@@ -1272,6 +1272,44 @@ function Rx.delay(seconds)
|
|
|
1272
1272
|
end
|
|
1273
1273
|
end
|
|
1274
1274
|
|
|
1275
|
+
--[=[
|
|
1276
|
+
Emits output every `n` seconds
|
|
1277
|
+
|
|
1278
|
+
@param initialDelaySeconds number
|
|
1279
|
+
@param seconds number
|
|
1280
|
+
@return (source: Observable<number>) -> Observable<number>
|
|
1281
|
+
]=]
|
|
1282
|
+
function Rx.timer(initialDelaySeconds, seconds)
|
|
1283
|
+
assert(type(initialDelaySeconds) == "number" or initialDelaySeconds == nil, "Bad initialDelaySeconds")
|
|
1284
|
+
assert(type(seconds) == "number", "Bad seconds")
|
|
1285
|
+
|
|
1286
|
+
return Observable.new(function(sub)
|
|
1287
|
+
local maid = Maid.new()
|
|
1288
|
+
|
|
1289
|
+
local number = -1
|
|
1290
|
+
local running = true
|
|
1291
|
+
|
|
1292
|
+
local thread = task.spawn(function()
|
|
1293
|
+
if initialDelaySeconds and initialDelaySeconds > 0 then
|
|
1294
|
+
task.wait(initialDelaySeconds)
|
|
1295
|
+
end
|
|
1296
|
+
|
|
1297
|
+
while running do
|
|
1298
|
+
number += 1
|
|
1299
|
+
sub:Fire(number)
|
|
1300
|
+
task.wait(seconds)
|
|
1301
|
+
end
|
|
1302
|
+
end)
|
|
1303
|
+
|
|
1304
|
+
maid:GiveTask(function()
|
|
1305
|
+
running = false
|
|
1306
|
+
coroutine.close(thread)
|
|
1307
|
+
end)
|
|
1308
|
+
|
|
1309
|
+
return maid
|
|
1310
|
+
end)
|
|
1311
|
+
end
|
|
1312
|
+
|
|
1275
1313
|
--[=[
|
|
1276
1314
|
Honestly, I have not used this one much.
|
|
1277
1315
|
|