Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I love the ability to set a set a promise for the timeout parameter.

please explain .



You can pass a promise into an $http request as a parameter. If you hold on to this promise and resolve it before the request returns, it cancels the request.

https://docs.angularjs.org/api/ng/service/$http


I assume the grandparent is talking about functions in Angular that take in a numeric timeout parameter and wants them to take in Promises instead, so he can reject the promises to signal that he wants to cancel the operation.

Kinda like CancellationToken in .Net, I guess.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: