On Tue, Dec 15, 2009 at 12:38 PM, Kyle <kylecorb...@gmail.com> wrote:
> I created a simple Chrome extension that simply tells a user how many
> notifications they have on Facebook, and then displays those
> notifications when the address bar icon is clicked.  I don't precache
> notifications because doing so would cause them to be marked as viewed
> on the Facebook site, so instead I wait until the button has been
> pressed and then initiate an XHR request to the Facebook servers to
> get the notification count.
>
> My problem is that even though the request was implemented
> asynchronously, for some reason the popup won't open at all until it
> has been fully processed.  This causes the window to seem laggy which
> is obviously undesireable.  I believe that my code itself is not at
> fault, because when I view the popup page through the chrome-
> extension:// protocol it seems to load the local HTML first and then
> load the notifications only once they've been parsed, as I intended.
>
> Should I be doing something differently, or is this an issue with the
> extension framework?

It's an issue with the extensions framework. However, you can work
around it by doing something like:

window.onload = function() {
  window.setTimeout(function() {
    // do initial xhr here.
  }, 0);
}

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to