Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animated gif pauses when ember.js objects are loading

Tags:

ember.js

Having a problem with a spinner actually spinning while ember.js is doing it's thing. I have a very generic jsfiddle example that illustrates the issue:

http://jsfiddle.net/h4ZcZ/2/

I assume there has to be a simple way to make this work as expected, but I am not finding it. I have tried using a JavaScript/CSS implementation of a spinner (spin.js) with the same results. I saw some stuff indicating this was typically an IE issue, but that is not the case here. This happens on all browser on Windows and i have tested on Mac Safari as well.

like image 684
BrianB Avatar asked Apr 27 '12 21:04

BrianB


2 Answers

The problem is your for loop--you're basically locking up the thread. I would use timeouts and chunk up the work to be done to give other processing needs on the page the ability to execute.

like image 198
Christopher Swasey Avatar answered Oct 18 '22 16:10

Christopher Swasey


As far as root cause, @ChristopherSwasey is correct. I asked a few other Ember developers about this. No solution, but two interesting thoughts that might help:

1) One developer reported that he has run into this problem and gotten around it by making sure the animated gif started before the long javascript execution.

2) Another developer suggested that using a virtualized list is the right path, so that only visible nodes are rendered. However, I'm afraid I don't know of an open source Ember virtualized list class yet.

Hope that helps.

like image 34
Luke Melia Avatar answered Oct 18 '22 18:10

Luke Melia