random .NET and web development musings

If your index page is slow to render, you may find you experience a flicker when calling:

navigator.splashscreen.hide();

i.e. the splash screen hides, you get a blank page, then your content appears.

You can remedy this by deferring the hiding of the slash screen until a few animation frames after you’ve finished drawing.

You may be able to achieve this using a setTimeout, however it will depend on what the rest of your code is doing.
A better approach (for writing your whole app anyway – regardless of this problem) is to use asynchronous DOM I/O, using something like fastdom.

Then you can simply do:

fastdom.defer(2, function () {
    navigator.splashscreen.hide();
});

This of course assumes that you’ve done all your other DOM I/O asynchronously (in the first animation frame). You may need to defer more than 2 frames depending on your setup.

NO COMMENTS
Post a comment