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
f5fb25b2
Commit
f5fb25b2
authored
Mar 06, 2013
by
Domenic Denicola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to the non-assimilation promise constructor stuff.
parent
fe14287a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
lib/rsvp.js
lib/rsvp.js
+13
-5
No files found.
lib/rsvp.js
View file @
f5fb25b2
...
@@ -9,6 +9,14 @@ var noop = function() {};
...
@@ -9,6 +9,14 @@ var noop = function() {};
var
Promise
=
function
(
resolver
)
{
var
Promise
=
function
(
resolver
)
{
var
promise
=
this
;
var
promise
=
this
;
if
(
typeof
resolver
!==
'
function
'
)
{
throw
new
TypeError
(
'
You must pass a resolver function as the sole argument to the promise constructor
'
);
}
if
(
!
(
promise
instanceof
Promise
))
{
return
new
Promise
(
resolver
);
}
var
resolvePromise
=
function
(
value
)
{
var
resolvePromise
=
function
(
value
)
{
resolve
(
promise
,
value
);
resolve
(
promise
,
value
);
resolvePromise
=
noop
;
resolvePromise
=
noop
;
...
@@ -29,9 +37,7 @@ var Promise = function(resolver) {
...
@@ -29,9 +37,7 @@ var Promise = function(resolver) {
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
},
this
);
},
this
);
if
(
resolver
)
{
resolver
(
resolvePromise
,
rejectPromise
);
resolver
(
resolvePromise
,
rejectPromise
);
}
};
};
var
invokeCallback
=
function
(
type
,
promise
,
callback
,
event
)
{
var
invokeCallback
=
function
(
type
,
promise
,
callback
,
event
)
{
...
@@ -69,8 +75,10 @@ var invokeCallback = function(type, promise, callback, event) {
...
@@ -69,8 +75,10 @@ var invokeCallback = function(type, promise, callback, event) {
};
};
Promise
.
prototype
=
{
Promise
.
prototype
=
{
constructor
:
Promise
,
then
:
function
(
done
,
fail
)
{
then
:
function
(
done
,
fail
)
{
var
thenPromise
=
new
Promise
();
var
thenPromise
=
new
Promise
(
function
()
{}
);
if
(
this
.
isFulfilled
)
{
if
(
this
.
isFulfilled
)
{
config
.
async
(
function
()
{
config
.
async
(
function
()
{
...
@@ -114,7 +122,7 @@ function reject(promise, value) {
...
@@ -114,7 +122,7 @@ function reject(promise, value) {
function
all
(
promises
)
{
function
all
(
promises
)
{
var
i
,
results
=
[];
var
i
,
results
=
[];
var
allPromise
=
new
Promise
();
var
allPromise
=
new
Promise
(
function
()
{}
);
var
remaining
=
promises
.
length
;
var
remaining
=
promises
.
length
;
if
(
remaining
===
0
)
{
if
(
remaining
===
0
)
{
...
...
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