Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS - Computation-Heavy Tasks

Is there a pattern in Angular apps for computation-heavy tasks? (Beyond just using $timeout with a delay of 0 to let them get off the call stack?) Even using $timeout seems to make the UI unresponsive when the processing itself kicks in. Do I need to be looking at Web Workers or something like that, or is there an "Angular way?"

like image 481
blaster Avatar asked Dec 05 '25 15:12

blaster


1 Answers

Because JavaScript is single threaded, you need to either do the computations server-side, or do the timeouts in between the processing (See underscore's defer(), http://underscorejs.org/#defer). Otherwise, the UI will inevitably get blocked.

like image 75
nekaab Avatar answered Dec 10 '25 10:12

nekaab