Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design patterns used in Gmail's JavaScript?

Can anyone tell me what design patterns (if any) were used when building Gmail? I understand the concept behind it - queue up some requests, increment the bar when each completes, init the display when all are down - but I'm specifically interested whether there's a specific design pattern I can use to mimic the features.

like image 875
Phillip B Oldham Avatar asked Mar 10 '09 13:03

Phillip B Oldham


1 Answers

I had a similar issue and solved it like so: Data preloading works by sending async requests to the server. When the progress bar is visible, I increment a counter for every request. The size of the progress bar == counter. Since the requests are sent quickly, the user never notices that the max value of the progress bar changes.

As a request answer comes in, I advance the progress bar once each time. That's all to it. When the last request arrives, the preloading is finished.

This looks better when the replies are small and arrive in quick succession but it works in all cases.

like image 86
Aaron Digulla Avatar answered Nov 12 '22 00:11

Aaron Digulla