Created
February 1, 2017 04:08
-
-
Save ccnokes/f88e70389652ab1a18354fd454ddf380 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $webview = document.querySelector('webview'); | |
const $loader = document.querySelector('.loader'); | |
let isInitialLoad = true; | |
$webview.addEventListener('did-start-loading', () => { | |
// we use client side rendering in the web app, so the loader is only needed on the first page load | |
if(isInitialLoad) { | |
$webview.classList.add('hide'); | |
$loader.classList.remove('loader-hide'); | |
isInitialLoad = false; | |
} | |
}); | |
$webview.addEventListener('dom-ready', () => { | |
$webview.classList.remove('hide'); | |
// have to delay in order for the webview show/resize to settle | |
setTimeout(() => { | |
$loader.classList.add('loader-hide'); | |
}, 100); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment