Merge branch 'develop'

This commit is contained in:
Alice Gaudon 2020-01-21 21:28:46 +01:00
commit 607949e5fc
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "tabs", "name": "tabs",
"version": "0.4.0", "version": "0.4.1",
"description": "Persistent and separate browser tabs in one window", "description": "Persistent and separate browser tabs in one window",
"author": { "author": {
"name": "Alice Gaudon", "name": "Alice Gaudon",

View File

@ -327,6 +327,8 @@ function setActiveService(serviceId) {
function loadService(serviceId, service) { function loadService(serviceId, service) {
// Load service if not loaded yet // Load service if not loaded yet
if (!service.view && !service.viewReady) { if (!service.view && !service.viewReady) {
console.log('Loading service', serviceId);
document.querySelector('#services > .loader').classList.remove('hidden'); document.querySelector('#services > .loader').classList.remove('hidden');
service.view = document.createElement('webview'); service.view = document.createElement('webview');
service.view.setAttribute('src', service.url); service.view.setAttribute('src', service.url);
@ -344,10 +346,11 @@ function loadService(serviceId, service) {
} }
document.querySelector('#services > .loader').classList.add('hidden'); document.querySelector('#services > .loader').classList.add('hidden');
updateNavigation();
service.li.classList.add('loaded'); service.li.classList.add('loaded');
service.viewReady = true; service.viewReady = true;
updateNavigation();
if (selectedService === null) { if (selectedService === null) {
setActiveService(serviceId); setActiveService(serviceId);
} }
@ -398,6 +401,7 @@ function unloadService(serviceId) {
function reloadService(serviceId) { function reloadService(serviceId) {
const service = services[serviceId]; const service = services[serviceId];
if (service.view && service.viewReady) { if (service.view && service.viewReady) {
console.log('Reloading service', serviceId);
document.querySelector('#services > .loader').classList.remove('hidden'); document.querySelector('#services > .loader').classList.remove('hidden');
service.view.reload(); service.view.reload();
} else if (!service.view && !service.viewReady) { } else if (!service.view && !service.viewReady) {
@ -435,7 +439,7 @@ function updateNavigation() {
function updateWindowTitle() { function updateWindowTitle() {
if (selectedService === null) { if (selectedService === null) {
ipcRenderer.send('updateWindowTitle', null); ipcRenderer.send('updateWindowTitle', null);
} else { } else if(services[selectedService].viewReady) {
ipcRenderer.send('updateWindowTitle', selectedService, services[selectedService].view.getWebContents().getTitle()); ipcRenderer.send('updateWindowTitle', selectedService, services[selectedService].view.getWebContents().getTitle());
} }
} }