Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rsvp.js
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
Romain Courteaud
rsvp.js
Commits
71f121c1
Commit
71f121c1
authored
May 10, 2013
by
Stefan Penner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup RSVP.all
parent
8c11dcc8
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
105 deletions
+28
-105
browser/rsvp.js
browser/rsvp.js
+9
-49
browser/rsvp.min.js
browser/rsvp.min.js
+1
-1
browser/rsvp/all.amd.js
browser/rsvp/all.amd.js
+7
-4
browser/rsvp/node.amd.js
browser/rsvp/node.amd.js
+0
-43
browser/rsvp/resolve.amd.js
browser/rsvp/resolve.amd.js
+2
-2
lib/rsvp/all.js
lib/rsvp/all.js
+7
-4
lib/rsvp/resolve.js
lib/rsvp/resolve.js
+2
-2
No files found.
browser/rsvp.js
View file @
71f121c1
...
...
@@ -39,7 +39,8 @@ define("rsvp/all",
function
all
(
promises
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
[],
remaining
=
promises
.
length
;
var
results
=
[],
remaining
=
promises
.
length
,
promise
;
if
(
remaining
===
0
)
{
resolve
([]);
...
...
@@ -59,10 +60,12 @@ define("rsvp/all",
}
for
(
var
i
=
0
;
i
<
promises
.
length
;
i
++
)
{
if
(
promises
[
i
]
&&
typeof
promises
[
i
].
then
===
'
function
'
)
{
promises
[
i
].
then
(
resolver
(
i
),
reject
);
promise
=
promises
[
i
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
promise
.
then
(
resolver
(
i
),
reject
);
}
else
{
resolveAll
(
i
,
promise
s
[
i
]
);
resolveAll
(
i
,
promise
);
}
}
});
...
...
@@ -315,50 +318,7 @@ define("rsvp/hash",
__exports__
.
hash
=
hash
;
});
define
(
"
rsvp/node
"
,
[
"
rsvp/promise
"
,
"
rsvp/all
"
,
"
exports
"
],
function
(
__dependency1__
,
__dependency2__
,
__exports__
)
{
"
use strict
"
;
var
Promise
=
__dependency1__
.
Promise
;
var
all
=
__dependency2__
.
all
;
function
makeNodeCallbackFor
(
resolve
,
reject
)
{
return
function
(
error
,
value
)
{
if
(
error
)
{
reject
(
error
);
}
else
if
(
arguments
.
length
>
2
)
{
resolve
(
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
else
{
resolve
(
value
);
}
};
}
function
denodeify
(
nodeFunc
)
{
return
function
()
{
var
nodeArgs
=
Array
.
prototype
.
slice
.
call
(
arguments
),
resolve
,
reject
;
var
promise
=
new
Promise
(
function
(
nodeResolve
,
nodeReject
)
{
resolve
=
nodeResolve
;
reject
=
nodeReject
;
});
all
(
nodeArgs
).
then
(
function
(
nodeArgs
)
{
nodeArgs
.
push
(
makeNodeCallbackFor
(
resolve
,
reject
));
try
{
nodeFunc
.
apply
(
this
,
nodeArgs
);
}
catch
(
e
)
{
reject
(
e
);
}
});
return
promise
;
};
}
__exports__
.
denodeify
=
denodeify
;
});
define
(
"
rsvp/promise
"
,
[
"
rsvp/config
"
,
"
rsvp/events
"
,
"
exports
"
],
...
...
@@ -568,12 +528,12 @@ define("rsvp/resolve",
return
typeof
x
===
"
function
"
||
(
typeof
x
===
"
object
"
&&
x
!==
null
);
}
function
resolve
(
thenable
){
function
resolve
(
thenable
)
{
if
(
thenable
instanceof
Promise
)
{
return
thenable
;
}
var
promise
=
new
Promise
(
function
(
resolve
,
reject
){
var
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
then
;
try
{
...
...
browser/rsvp.min.js
View file @
71f121c1
This diff is collapsed.
Click to expand it.
browser/rsvp/all.amd.js
View file @
71f121c1
...
...
@@ -6,7 +6,8 @@ define(
function
all
(
promises
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
[],
remaining
=
promises
.
length
;
var
results
=
[],
remaining
=
promises
.
length
,
promise
;
if
(
remaining
===
0
)
{
resolve
([]);
...
...
@@ -26,10 +27,12 @@ define(
}
for
(
var
i
=
0
;
i
<
promises
.
length
;
i
++
)
{
if
(
promises
[
i
]
&&
typeof
promises
[
i
].
then
===
'
function
'
)
{
promises
[
i
].
then
(
resolver
(
i
),
reject
);
promise
=
promises
[
i
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
promise
.
then
(
resolver
(
i
),
reject
);
}
else
{
resolveAll
(
i
,
promise
s
[
i
]
);
resolveAll
(
i
,
promise
);
}
}
});
...
...
browser/rsvp/node.amd.js
View file @
71f121c1
define
(
[
"
rsvp/promise
"
,
"
rsvp/all
"
,
"
exports
"
],
function
(
__dependency1__
,
__dependency2__
,
__exports__
)
{
"
use strict
"
;
var
Promise
=
__dependency1__
.
Promise
;
var
all
=
__dependency2__
.
all
;
function
makeNodeCallbackFor
(
resolve
,
reject
)
{
return
function
(
error
,
value
)
{
if
(
error
)
{
reject
(
error
);
}
else
if
(
arguments
.
length
>
2
)
{
resolve
(
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
else
{
resolve
(
value
);
}
};
}
function
denodeify
(
nodeFunc
)
{
return
function
()
{
var
nodeArgs
=
Array
.
prototype
.
slice
.
call
(
arguments
),
resolve
,
reject
;
var
promise
=
new
Promise
(
function
(
nodeResolve
,
nodeReject
)
{
resolve
=
nodeResolve
;
reject
=
nodeReject
;
});
all
(
nodeArgs
).
then
(
function
(
nodeArgs
)
{
nodeArgs
.
push
(
makeNodeCallbackFor
(
resolve
,
reject
));
try
{
nodeFunc
.
apply
(
this
,
nodeArgs
);
}
catch
(
e
)
{
reject
(
e
);
}
});
return
promise
;
};
}
__exports__
.
denodeify
=
denodeify
;
});
browser/rsvp/resolve.amd.js
View file @
71f121c1
...
...
@@ -8,12 +8,12 @@ define(
return
typeof
x
===
"
function
"
||
(
typeof
x
===
"
object
"
&&
x
!==
null
);
}
function
resolve
(
thenable
){
function
resolve
(
thenable
)
{
if
(
thenable
instanceof
Promise
)
{
return
thenable
;
}
var
promise
=
new
Promise
(
function
(
resolve
,
reject
){
var
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
then
;
try
{
...
...
lib/rsvp/all.js
View file @
71f121c1
...
...
@@ -2,7 +2,8 @@ import { Promise } from "rsvp/promise";
function
all
(
promises
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
[],
remaining
=
promises
.
length
;
var
results
=
[],
remaining
=
promises
.
length
,
promise
;
if
(
remaining
===
0
)
{
resolve
([]);
...
...
@@ -22,10 +23,12 @@ function all(promises) {
}
for
(
var
i
=
0
;
i
<
promises
.
length
;
i
++
)
{
if
(
promises
[
i
]
&&
typeof
promises
[
i
].
then
===
'
function
'
)
{
promises
[
i
].
then
(
resolver
(
i
),
reject
);
promise
=
promises
[
i
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
promise
.
then
(
resolver
(
i
),
reject
);
}
else
{
resolveAll
(
i
,
promise
s
[
i
]
);
resolveAll
(
i
,
promise
);
}
}
});
...
...
lib/rsvp/resolve.js
View file @
71f121c1
...
...
@@ -4,12 +4,12 @@ function objectOrFunction(x) {
return
typeof
x
===
"
function
"
||
(
typeof
x
===
"
object
"
&&
x
!==
null
);
}
function
resolve
(
thenable
){
function
resolve
(
thenable
)
{
if
(
thenable
instanceof
Promise
)
{
return
thenable
;
}
var
promise
=
new
Promise
(
function
(
resolve
,
reject
){
var
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
then
;
try
{
...
...
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