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

Provide interface to clear $defer's #469

Closed
unirgy opened this issue Jul 13, 2011 · 5 comments
Closed

Provide interface to clear $defer's #469

unirgy opened this issue Jul 13, 2011 · 5 comments

Comments

@unirgy
Copy link
Contributor

unirgy commented Jul 13, 2011

It's possible to call window.clearTimeout() with the result of window.setTimeout() , but not so with $defer service.

Please either provide a way to clear $defer's within angular.js or return result of setTimeout, so it can be cleared outside.

self.defer = function(fn, delay) {
outstandingRequestCount++;
// ADDED return:
return setTimeout(function() { completeOutstandingRequest(fn); }, delay || 0);
};

angularServiceInject('$defer', function($browser, $exceptionHandler, $updateView) {
return function(fn, delay) {
// ADDED return:
return $browser.defer(function() {
try {
fn();
} catch(e) {
$exceptionHandler(e);
} finally {
$updateView();
}
}, delay);
};
}, ['$browser', '$exceptionHandler', '$updateView']);

@IgorMinar
Copy link
Contributor

this is already implemented in: IgorMinar@b004276

it just needs to be polished and merged into master repo

@IgorMinar
Copy link
Contributor

in master: #480

@vojtajina
Copy link
Contributor

This commit adds the feature on $browser level, but not on $defer service...
Let's do it on $defer level and remove this stuff from $browser....

@vojtajina vojtajina reopened this Aug 16, 2011
@IgorMinar
Copy link
Contributor

Ok
On Aug 16, 2011 1:22 AM, "vojtajina" <
reply@reply.github.com>
wrote:

This commit adds the feature on $browser level, but not on $defer
service...
Let's do it on $defer level and remove this stuff from $browser....

Reply to this email directly or view it on GitHub:
#469 (comment)

@IgorMinar
Copy link
Contributor

this has been implemented already

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