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
d6449937
Commit
d6449937
authored
Sep 25, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RSVP.Queue should work without new.
parent
7086f51f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
lib/rsvp/queue.js
lib/rsvp/queue.js
+4
-2
test/tests/extension_test.js
test/tests/extension_test.js
+10
-0
No files found.
lib/rsvp/queue.js
View file @
d6449937
...
@@ -18,6 +18,10 @@ var Queue = function() {
...
@@ -18,6 +18,10 @@ var Queue = function() {
fulfill
,
fulfill
,
reject
;
reject
;
if
(
!
(
this
instanceof
Queue
))
{
return
new
Queue
();
}
function
canceller
()
{
function
canceller
()
{
for
(
var
i
=
0
;
i
<
promise_list
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
promise_list
.
length
;
i
++
)
{
promise_list
[
i
].
cancel
();
promise_list
[
i
].
cancel
();
...
@@ -65,8 +69,6 @@ var Queue = function() {
...
@@ -65,8 +69,6 @@ var Queue = function() {
return
this
;
return
this
;
};
};
return
promise
;
};
};
Queue
.
prototype
=
Object
.
create
(
Promise
.
prototype
);
Queue
.
prototype
=
Object
.
create
(
Promise
.
prototype
);
...
...
test/tests/extension_test.js
View file @
d6449937
...
@@ -1803,6 +1803,16 @@ describe("`RSVP.Queue`", function () {
...
@@ -1803,6 +1803,16 @@ describe("`RSVP.Queue`", function () {
assert
(
promise
instanceof
RSVP
.
Queue
);
assert
(
promise
instanceof
RSVP
.
Queue
);
assert
(
promise
instanceof
RSVP
.
Promise
);
assert
(
promise
instanceof
RSVP
.
Promise
);
});
});
it
(
'
should work without `new`
'
,
function
(
done
)
{
var
promise
=
RSVP
.
Queue
()
.
push
(
function
()
{
return
'
value
'
;
});
promise
.
then
(
function
(
value
)
{
assert
.
equal
(
value
,
'
value
'
);
done
();
});
});
});
});
describe
(
"
`push`
"
,
function
()
{
describe
(
"
`push`
"
,
function
()
{
...
...
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