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

Provide interface to clear $defer's #469

Closed
@unirgy

Description

@unirgy

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']);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions