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
41eba17a
Commit
41eba17a
authored
Feb 06, 2014
by
Tristan Cavelier
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notifications are not propagated to parents fixed
parent
fdaaddad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
lib/rsvp/promise.js
lib/rsvp/promise.js
+5
-0
test/tests/extension_test.js
test/tests/extension_test.js
+25
-0
No files found.
lib/rsvp/promise.js
View file @
41eba17a
...
...
@@ -203,6 +203,11 @@ function handleThenable(promise, value) {
then
=
value
.
then
;
if
(
isFunction
(
then
))
{
if
(
isFunction
(
value
.
on
))
{
value
.
on
(
'
promise:notified
'
,
function
(
event
)
{
notify
(
promise
,
event
.
detail
);
});
}
promise
.
on
(
'
promise:cancelled
'
,
function
(
event
)
{
if
(
isFunction
(
value
.
cancel
))
{
value
.
cancel
();
...
...
test/tests/extension_test.js
View file @
41eba17a
...
...
@@ -236,6 +236,31 @@ describe("RSVP extensions", function() {
});
});
it
(
'
notify should propagate to parent `then`
'
,
function
(
done
)
{
var
i
=
0
,
responses
=
[];
new
RSVP
.
Promise
(
function
(
resolve
)
{
resolve
();
}).
then
(
function
()
{
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
,
notify
)
{
notify
(
1
);
notify
(
2
);
resolve
(
3
);
});
}).
then
(
function
(
answer
)
{
responses
.
push
(
answer
);
},
null
,
function
(
notification
)
{
responses
.
push
(
notification
);
});
setTimeout
(
function
()
{
assert
(
responses
[
0
]
===
1
,
"
Notified once
"
);
assert
(
responses
[
1
]
===
2
,
"
Notified twice
"
);
assert
(
responses
[
2
]
===
3
,
"
Fulfilled after notifications
"
);
done
();
},
50
);
});
describe
(
'
assimilation
'
,
function
()
{
it
(
'
should assimilate if `resolve` is called with a fulfilled promise
'
,
function
(
done
)
{
var
originalPromise
=
new
RSVP
.
Promise
(
function
(
resolve
)
{
resolve
(
'
original value
'
);
});
...
...
Romain Courteaud
@romain
mentioned in commit
b2adfc96
·
May 18, 2018
mentioned in commit
b2adfc96
mentioned in commit b2adfc96c65fcefb2c54b1e4c6c3d1eb3a647073
Toggle commit list
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