-
Add opts.skipDigest for DataService.watch · 3b37289a
- provides mechanism to keep WebSockets from spamming the $digest loop - flips invokeApply passed to the internal $timeout calls, stopping a $digest loop & avoiding a render. - DataService._watchOpOnMessage also honors the skipDigest flag, which is plumbed down through .watch() -> .startListOp -> ._listOpComplete -> ._startWatchOp -> ._watchOpOnMessage example usage: DataService.watch(resource, context, (data) => { // optionally call $applyAsync here in controlling code // to manually run a $digest $scope.$applyAsync(() => { // do stuff with data here }); }, { skipDigest: true }); // or Debounce DataService.watch(resource, context, _.debounce(() => { // $apply here, inside debounce }, 400), { skipDigest: true });benjaminapetersen committed