mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-24 15:50:01 +00:00
Simplified Promise.all implementation
This commit is contained in:
parent
a25ad236ae
commit
8f093eec98
1 changed files with 1 additions and 11 deletions
|
@ -144,16 +144,6 @@ function Promise.all(promises)
|
|||
local results = {}
|
||||
local totalCount = #promises
|
||||
local finishedCount = 0
|
||||
local rejected = false
|
||||
|
||||
local function rejectedHandler(value)
|
||||
if rejected then
|
||||
return
|
||||
end
|
||||
|
||||
rejected = true
|
||||
reject(value)
|
||||
end
|
||||
|
||||
for index, promise in ipairs(promises) do
|
||||
promise:andThen(function(value)
|
||||
|
@ -163,7 +153,7 @@ function Promise.all(promises)
|
|||
if finishedCount == totalCount then
|
||||
resolve(results)
|
||||
end
|
||||
end, rejectedHandler)
|
||||
end, reject)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue