From 6b91aa0a18098100e5f50ea911ee135b50680d67 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 22 Aug 2013 02:08:41 -0700 Subject: feat(Scope): async auto-flush $evalAsync queue when outside of $digest This change causes a new $digest to be scheduled in the next tick if a task was was sent to the $evalAsync queue from outside of a $digest or an $apply. While this mode of operation is not common for most of the user code, this change means that $q promises that utilze $evalAsync queue to guarantee asynchronicity of promise apis will now also resolve outside of a $digest, which turned out to be a big pain point for some developers. The implementation ensures that we don't do more work than needed and that we coalese as much work as possible into a single $digest. The use of $browser instead of setTimeout ensures that we can mock out and control the scheduling of "auto-flush", which should in theory allow all of the existing code and tests to work without negative side-effects. Closes #3539 Closes #2438 --- src/ng/timeout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ng/timeout.js') diff --git a/src/ng/timeout.js b/src/ng/timeout.js index 6cb62d7a..a32538ee 100644 --- a/src/ng/timeout.js +++ b/src/ng/timeout.js @@ -36,7 +36,7 @@ function $TimeoutProvider() { var deferred = $q.defer(), promise = deferred.promise, skipApply = (isDefined(invokeApply) && !invokeApply), - timeoutId, cleanup; + timeoutId; timeoutId = $browser.defer(function() { try { -- cgit v1.2.3