Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
jio
Commits
17a1ed21
Commit
17a1ed21
authored
Sep 05, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Promise.all and allOrNone notifies sub progress
parent
38888aee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/jio/core/Promise.js
src/jio/core/Promise.js
+8
-4
No files found.
src/jio/core/Promise.js
View file @
17a1ed21
...
...
@@ -169,7 +169,6 @@ 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
)
{
...
...
@@ -178,8 +177,13 @@ Promise.all = function (items) {
return
solver
.
resolve
(
array
);
};
}
function
notify
(
i
)
{
return
function
(
answer
)
{
solver
.
notify
(
i
,
answer
);
};
}
for
(
i
=
0
;
i
<
items
.
length
;
i
+=
1
)
{
Promise
.
when
(
items
[
i
],
succeed
(
i
),
succeed
(
i
));
Promise
.
when
(
items
[
i
],
succeed
(
i
),
succeed
(
i
)
,
notify
(
i
)
);
}
return
next
;
};
...
...
@@ -204,7 +208,6 @@ 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
)
{
...
...
@@ -212,8 +215,9 @@ Promise.allOrNone = function (items) {
}
return
solver
.
resolve
(
array
);
},
function
(
answer
)
{
solver
.
notify
(
i
);
return
solver
.
reject
(
answer
);
},
function
(
answer
)
{
solver
.
notify
(
i
,
answer
);
});
});
return
next
;
...
...
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