Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$http.notify shortcut method #11020

Closed
mallowigi opened this issue Feb 10, 2015 · 4 comments
Closed

$http.notify shortcut method #11020

mallowigi opened this issue Feb 10, 2015 · 4 comments

Comments

@mallowigi
Copy link

Hi,

I wonder if it is possible to add a shorthand method notify to the $http service to trigger notify callbacks? It would be better than doing:

var interval = $interval(myFunction, 10000);

// Before
interval.then(null, null, (data) => console.log(data););

// After
interval.notify(data => console.log(data););
@Narretz
Copy link
Contributor

Narretz commented Feb 16, 2015

I don't get it tbh. What exactly do you want to do? I don't see any $http in your example, I only see $interval.

@Narretz Narretz added this to the Purgatory milestone Feb 16, 2015
@mallowigi
Copy link
Author

Sorry, my bad. I meant something like .catch in thenables, but only for the sake of the notify operation.

Example:

$http.notify(function onNotify () { ... }) // instead of $http.then(onSuccess, onFailure, onNotify)

@Narretz Narretz changed the title $http.notify method ? $http.notify shortcut method Feb 16, 2015
@Narretz Narretz modified the milestones: Ice Box, Purgatory Feb 16, 2015
@Narretz
Copy link
Contributor

Narretz commented Feb 16, 2015

This could possibly be very confusing, as notify might be misunderstood as the xhr progress event.

@pkozlowski-opensource
Copy link
Member

Nope, sorry, it won't happen. Progress notifications as part of promises turned out to be a bad idea. On top of this it seems like the convenience methods (success / error) are often confused with promises (ex.: #10508) so we don't want to go down this path.

Thnx for the suggestion @mallowigi but we will pass on this one...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants