@quenty/promise 6.5.0 → 6.6.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 +2 -2
- package/src/Shared/PromiseUtils.lua +16 -5
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
|
+
# [6.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promise@6.5.0...@quenty/promise@6.6.0) (2023-06-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Performance gain from PromiseUtils.combine() ([b7cdd9f](https://github.com/Quenty/NevermoreEngine/commit/b7cdd9f67bf5d6933b0335524bad353ba254ccf6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [6.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promise@6.4.1...@quenty/promise@6.5.0) (2023-04-10)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/promise",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.0",
|
|
4
4
|
"description": "Promise implementation for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "dc77d6de09e9eb9d3fd6dafd790c052d8393d38f"
|
|
36
36
|
}
|
|
@@ -84,12 +84,21 @@ function PromiseUtils.combine(stateTable)
|
|
|
84
84
|
assert(type(stateTable) == "table", "Bad stateTable")
|
|
85
85
|
|
|
86
86
|
local remainingCount = 0
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
local results = {}
|
|
88
|
+
|
|
89
|
+
for key, value in pairs(stateTable) do
|
|
90
|
+
if Promise.isPromise(value) then
|
|
91
|
+
remainingCount = remainingCount + 1
|
|
92
|
+
else
|
|
93
|
+
results[key] = value
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if remainingCount == 0 then
|
|
98
|
+
return Promise.resolved(stateTable)
|
|
89
99
|
end
|
|
90
100
|
|
|
91
101
|
local returnPromise = Promise.new()
|
|
92
|
-
local results = {}
|
|
93
102
|
local allFulfilled = true
|
|
94
103
|
|
|
95
104
|
local function syncronize(key, isFullfilled)
|
|
@@ -105,8 +114,10 @@ function PromiseUtils.combine(stateTable)
|
|
|
105
114
|
end
|
|
106
115
|
end
|
|
107
116
|
|
|
108
|
-
for key,
|
|
109
|
-
|
|
117
|
+
for key, value in pairs(stateTable) do
|
|
118
|
+
if Promise.isPromise(value) then
|
|
119
|
+
value:Then(syncronize(key, true), syncronize(key, false))
|
|
120
|
+
end
|
|
110
121
|
end
|
|
111
122
|
|
|
112
123
|
return returnPromise
|