diff options
| author | Misko Hevery | 2011-08-10 13:15:43 -0700 |
|---|---|---|
| committer | Misko Hevery | 2011-08-12 15:47:47 -0700 |
| commit | 42062dab34192d2cb9ed66a720c0f791408c61c0 (patch) | |
| tree | ca85b56f12dd0138dbe3d7f1346c4125d64e09a5 /src/service/updateView.js | |
| parent | 1c9fc1e1dec67c8c05f02da1e0853439238c4d8e (diff) | |
| download | angular.js-42062dab34192d2cb9ed66a720c0f791408c61c0.tar.bz2 | |
refactor(scope): remove $flush/$observe ng:eval/ng:eval-order
Diffstat (limited to 'src/service/updateView.js')
| -rw-r--r-- | src/service/updateView.js | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/service/updateView.js b/src/service/updateView.js deleted file mode 100644 index b51e719b..00000000 --- a/src/service/updateView.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -/** - * @workInProgress - * @ngdoc service - * @name angular.service.$updateView - * @requires $browser - * - * @description - * Calling `$updateView` enqueues the eventual update of the view. (Update the DOM to reflect the - * model). The update is eventual, since there are often multiple updates to the model which may - * be deferred. The default update delayed is 25 ms. This means that the view lags the model by - * that time. (25ms is small enough that it is perceived as instantaneous by the user). The delay - * can be adjusted by setting the delay property of the service. - * - * <pre>angular.service('$updateView').delay = 10</pre> - * - * The delay is there so that multiple updates to the model which occur sufficiently close - * together can be merged into a single update. - * - * You don't usually call '$updateView' directly since angular does it for you in most cases, - * but there are some cases when you need to call it. - * - * - `$updateView()` called automatically by angular: - * - Your Application Controllers: Your controller code is called by angular and hence - * angular is aware that you may have changed the model. - * - Your Services: Your service is usually called by your controller code, hence same rules - * apply. - * - May need to call `$updateView()` manually: - * - Widgets / Directives: If you listen to any DOM events or events on any third party - * libraries, then angular is not aware that you may have changed state state of the - * model, and hence you need to call '$updateView()' manually. - * - 'setTimeout'/'XHR': If you call 'setTimeout' (instead of {@link angular.service.$defer}) - * or 'XHR' (instead of {@link angular.service.$xhr}) then you may be changing the model - * without angular knowledge and you may need to call '$updateView()' directly. - * - * Note: if you wish to update the view immediately (without delay), you can do so by calling - * {@link angular.scope.$apply} at any time from your code: - * <pre>scope.$apply()</pre> - * - * In unit-test mode the update is instantaneous and synchronous to simplify writing tests. - * - */ - -function serviceUpdateViewFactory($browser){ - var rootScope = this; - var scheduled; - function update(){ - scheduled = false; - rootScope.$flush(); - } - return $browser.isMock ? update : function(){ - if (!scheduled) { - scheduled = true; - $browser.defer(update, serviceUpdateViewFactory.delay); - } - }; -} -serviceUpdateViewFactory.delay = 25; - -angularServiceInject('$updateView', serviceUpdateViewFactory, ['$browser']); |
