Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.