2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-11 07:41:04 +00:00

Hide the webview until it finishes loading

This commit is contained in:
Jia Hao 2016-01-19 21:55:50 +08:00
parent 5c91cf231b
commit 981c176894

View File

@ -4,6 +4,9 @@
var ipc = require('electron').ipcRenderer; var ipc = require('electron').ipcRenderer;
var webViewDiv = document.getElementById('webViewDiv');
webViewDiv.style.visibility = 'hidden';
var webView; var webView;
ipc.on('params', function (event, message) { ipc.on('params', function (event, message) {
@ -11,7 +14,6 @@ ipc.on('params', function (event, message) {
document.title = appArgs.name; document.title = appArgs.name;
webView = document.createElement('webview'); webView = document.createElement('webview');
webView.setAttribute('id', 'webView'); webView.setAttribute('id', 'webView');
webView.setAttribute('src', appArgs.targetUrl); webView.setAttribute('src', appArgs.targetUrl);
webView.setAttribute('autosize', 'on'); webView.setAttribute('autosize', 'on');
@ -28,6 +30,7 @@ ipc.on('params', function (event, message) {
}); });
webView.addEventListener('did-finish-load', function (e) { webView.addEventListener('did-finish-load', function (e) {
webViewDiv.style.visibility = 'visible';
var loadingContainer = document.getElementById('loading-container'); var loadingContainer = document.getElementById('loading-container');
loadingContainer.parentNode.removeChild(loadingContainer); loadingContainer.parentNode.removeChild(loadingContainer);
@ -41,7 +44,7 @@ ipc.on('params', function (event, message) {
}); });
var webViewDiv = document.getElementById('webViewDiv');
webViewDiv.appendChild(webView); webViewDiv.appendChild(webView);
}); });