ochrons / scalajs-spa-tutorial

Tutorial for creating a simple Single Page Application in ScalaJS
Apache License 2.0
672 stars 228 forks source link

How to simulate lag #36

Closed mb720 closed 8 years ago

mb720 commented 8 years ago

Hi,

I was wondering how to simulate server-side delays to test "Loading..." messages on the client side. In the tutorial I've seen that the server does Thread.sleep(300) a couple of times and that the client uses proxy().renderPending(_ > 500, _ => <.p("Loading...")),.

Somehow I expected that if I increased the time the server sleeps to, say, three seconds, that I would then see a "Loading..." message at the client but this is not the case.

Is there a way to simulate a slow or flaky internet connection between server and client while doing localhost development?

Thanks a lot in advance, Matthias

ochrons commented 8 years ago

In Chrome developer tools Network panel you can simulate network throttling. That should create enough lag for these delay effects to show. Although, I haven't really tested that part of SPA tutorial, so maybe it has a bug, too :)

ochrons commented 8 years ago

Did you get this to work?

mb720 commented 8 years ago

I'm confident that I can simulate lag using the browser's developer tools but I didn't try it.