-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($http): upload and download event #7995
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
Based on @benjamingr thoughts in #1934 (comment) |
This is a con, we're going to need tests if this is ever going to land. |
@@ -68,6 +68,20 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc | |||
} | |||
}); | |||
|
|||
if (typeof progressCallback === "function") { | |||
if ("addEventListener" in xhr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addEventListener is supported in every browser that supports progress events (so the else
is not really necessary) --- alternatively, could always just use the else
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@caitp added some tests. I dunno how to test |
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
@caitp rebased. Any news/recomendations? |
Just want to follow up - what is the status on this PR? |
I guess we can't really do any better than those tests in karma... @juliemr / @vojtajina how about another flaky e2e test for making requests to the docs server? In the cards or no? I personally like the feature, so I'd like to get this in in some form, but maybe we need to clean this up in some fashion. |
@caitp any news on this? |
Oh, I guess I should have mentioned this in the meeting --- i left this tab open so that I'd remember, but I got tied up with webkit issues =) @IgorMinar what do you think about landing this in one of the release candidates? I still feel like a real test case is needed, but maybe it's not in the cards due to flakiness |
86fcb95
to
30db360
Compare
@caitp @IgorMinar rebased on top of fresh master. |
all your files have become executable =) Can we keep it 100644 please --- also, the httpBackend tests are okay, but it doesn't really tell us much about how the feature works, which is why I was saying another e2e test would be good. The problem with e2e tests is... flakiness, so unfortunately they are a bit problematic. But maybe it's worth it in this case. |
30db360
to
2965b18
Compare
@caitp fixed file modes. I don't know how to test this much as I mentioned before. |
yep don't worry about it, if we can do an E2E test we can probably add it during merging, but I think we probably won't right away due to the problematic-ness |
02dc2aa
to
fd2d6c0
Compare
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
I have a degration suggestion. This would be possible with listening for the stagechange event
This would be useful if you are converting a file to another format were it would take long to upload a big file and download a big file in same request, with slow bandwidth You would then know if it has started / if it has uploaded / if it's downloading and when its done. You could tell if it is half way there If this is no good idea. then we should maybe make a option to get hold of the stagechange event and do it ourself. alternative expose the xhr as many already have requested. |
2965b18
to
b46f35e
Compare
CLAs look good, thanks! |
@b1rdex I think that this PR is a good one to kick off the discussion but it is not in the state where it could be merged. If you (or anyone else) is interested in taking this work further I've left some comments in the original issue. This feature could potentially land in 1.4 as I don't think we need huge amount of code to be written - it is just that we need to figure out number of issues I've raised in my comments. |
About ie: only one idea for fallback here - emit progress 0 and 100% About digest cycle: I think it shouldn't trigger digest itself. And no About download vs upload: it's mostly not real world use case if you track
|
eded36c
to
ed51114
Compare
ed51114
to
fde8f67
Compare
As a solution for #1934 and opposite for #3606
You can add progressCallback using
config.progress
.Working for all kind of requests — you can even track progress of
delete
requests.Pros:
Cons:
1. No specs and tests here, it's just working