Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
lucas.parsy
jio
Commits
639e5b94
Commit
639e5b94
authored
Sep 02, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Promise.all and allOrNone notifies when a promise ended
parent
1e7672c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
src/jio/core/Promise.js
src/jio/core/Promise.js
+3
-0
No files found.
src/jio/core/Promise.js
View file @
639e5b94
...
...
@@ -168,6 +168,7 @@ Promise.all = function (items) {
solver
=
next
.
defer
();
function
succeed
(
i
)
{
return
function
(
answer
)
{
solver
.
notify
(
i
);
array
[
i
]
=
answer
;
count
+=
1
;
if
(
count
!==
items
.
length
)
{
...
...
@@ -202,6 +203,7 @@ Promise.allOrNone = function (items) {
solver
=
next
.
defer
();
items
.
forEach
(
function
(
item
,
i
)
{
Promise
.
when
(
item
,
function
(
answer
)
{
solver
.
notify
(
i
);
array
[
i
]
=
answer
;
count
+=
1
;
if
(
count
!==
items
.
length
)
{
...
...
@@ -209,6 +211,7 @@ Promise.allOrNone = function (items) {
}
return
solver
.
resolve
(
array
);
},
function
(
answer
)
{
solver
.
notify
(
i
);
return
solver
.
reject
(
answer
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment