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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
rsvp.js
Commits
55398c39
Commit
55398c39
authored
May 10, 2013
by
Stefan Penner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
short-circuit RSVP.resolve is resolving RSVP.Promise
parent
889827fd
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
4 deletions
+19
-4
browser/rsvp.js
browser/rsvp.js
+4
-1
browser/rsvp.min.js
browser/rsvp.min.js
+1
-1
browser/rsvp/resolve.amd.js
browser/rsvp/resolve.amd.js
+4
-1
lib/rsvp/resolve.js
lib/rsvp/resolve.js
+4
-1
tests/extension-tests.js
tests/extension-tests.js
+6
-0
No files found.
browser/rsvp.js
View file @
55398c39
...
...
@@ -566,12 +566,15 @@ define("rsvp/resolve",
"
use strict
"
;
var
Promise
=
__dependency1__
.
Promise
;
function
objectOrFunction
(
x
)
{
return
typeof
x
===
"
function
"
||
(
typeof
x
===
"
object
"
&&
x
!==
null
);
}
function
resolve
(
thenable
){
if
(
thenable
instanceof
Promise
)
{
return
thenable
;
}
var
promise
=
new
Promise
(
function
(
resolve
,
reject
){
var
then
;
...
...
browser/rsvp.min.js
View file @
55398c39
This diff is collapsed.
Click to expand it.
browser/rsvp/resolve.amd.js
View file @
55398c39
...
...
@@ -4,12 +4,15 @@ define(
"
use strict
"
;
var
Promise
=
__dependency1__
.
Promise
;
function
objectOrFunction
(
x
)
{
return
typeof
x
===
"
function
"
||
(
typeof
x
===
"
object
"
&&
x
!==
null
);
}
function
resolve
(
thenable
){
if
(
thenable
instanceof
Promise
)
{
return
thenable
;
}
var
promise
=
new
Promise
(
function
(
resolve
,
reject
){
var
then
;
...
...
lib/rsvp/resolve.js
View file @
55398c39
import
{
Promise
}
from
"
rsvp/promise
"
;
function
objectOrFunction
(
x
)
{
return
typeof
x
===
"
function
"
||
(
typeof
x
===
"
object
"
&&
x
!==
null
);
}
function
resolve
(
thenable
){
if
(
thenable
instanceof
Promise
)
{
return
thenable
;
}
var
promise
=
new
Promise
(
function
(
resolve
,
reject
){
var
then
;
...
...
tests/extension-tests.js
View file @
55398c39
...
...
@@ -613,6 +613,12 @@ describe("RSVP extensions", function() {
assert
(
RSVP
.
resolve
);
});
specify
(
"
it short circuits if RSVP.promise
"
,
function
(){
var
deferred
=
new
RSVP
.
defer
();
assert
.
equal
(
RSVP
.
resolve
(
deferred
.
promise
),
deferred
.
promise
);
});
describe
(
"
1. If x is a promise, adopt its state
"
,
function
(){
specify
(
"
1.1 If x is pending, promise must remain pending until x is fulfilled or rejected.
"
,
function
(
done
){
var
expectedValue
,
resolver
,
thenable
,
wrapped
;
...
...
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