|
25 | 25 | */ |
26 | 26 | angular.module('firebase').factory('$FirebaseObject', [ |
27 | 27 | '$parse', '$firebaseUtils', '$log', '$interval', |
28 | | - function($parse, $firebaseUtils, $log, $interval) { |
| 28 | + function($parse, $firebaseUtils, $log) { |
29 | 29 | /** |
30 | 30 | * This constructor should probably never be called manually. It is used internally by |
31 | 31 | * <code>$firebase.$asObject()</code>. |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 |
|
363 | | - // Okay, so this magic hack is um... magic. It increments a |
364 | | - // variable every 50 seconds (counterKey) so that whenever $digest |
365 | | - // is run, the variable will be dirty. This allows us to determine |
366 | | - // when $digest is invoked, manually check the meta vars, and |
367 | | - // manually invoke our watcher if the $ prefixed data has changed |
368 | | - (function() { |
369 | | - // create a counter and store it in scope |
370 | | - var counterKey = '_firebaseCounterForVar'+varName; |
371 | | - scope[counterKey] = 0; |
372 | | - // update the counter every 51ms |
373 | | - // why 51? because it must be greater than scopeUpdated's debounce |
374 | | - // or protractor has a conniption |
375 | | - var to = $interval(function() { |
376 | | - scope[counterKey]++; |
377 | | - }, 51, 0, false); |
378 | | - // watch the counter for changes (which means $digest ran) |
379 | | - self.subs.push(scope.$watch(counterKey, checkMetaVars)); |
380 | | - // cancel our interval and clear var from scope if unbound |
381 | | - self.subs.push(function() { |
382 | | - $interval.cancel(to); |
383 | | - delete scope[counterKey]; |
384 | | - }); |
385 | | - })(); |
| 363 | + self.subs.push(scope.$watch(checkMetaVars)); |
386 | 364 |
|
387 | 365 | setScope(rec); |
388 | 366 | self.subs.push(scope.$on('$destroy', self.unbind.bind(self))); |
|
0 commit comments