lurumad/cpu-monitor — pull request #1 by Foxandxss (2014-02-17 10:56:12+00:00)
Title: Proper error handling on cpu utilization callback

If you ever need to run an `$apply`, always wrap the code inside it.

What `$apply` does is to run a `$digest` when the cpu utilization changes, you change the scope and then `$apply` it to update the DOM. That means that your way works. You change the scope and then apply to run a digest.

So far so good but the good part of $apply is that it runs inside a try/catch block which will fire your exception handler. That means that if you have let's say `toastr` popping of failures, you will never have one if this update fails. Doing it in this way, if it fails, then the catch will run (You know, typical try/catch :P)

Test it, and apply it :)