From 476b5a10395078129c81187e3d5e199de5fd3221 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Mon, 4 Jul 2016 22:31:41 -0300 Subject: [PATCH] Improved speed of the app Fixes #23 . Seems like Electron is caching services (webview) by default. --- app.json | 10 ++++++++-- app/Application.js | 3 +++ app/store/Services.js | 1 - app/ux/WebView.js | 3 --- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app.json b/app.json index d5c1c783..6daaaa85 100644 --- a/app.json +++ b/app.json @@ -248,7 +248,10 @@ * */ "output": { - "base": "${workspace.build.dir}/${build.environment}/${app.name}" + "base": "${workspace.build.dir}/${build.environment}/${app.name}", + "appCache": { + "enable": true + } }, /** @@ -259,7 +262,10 @@ * List of items in the CACHE MANIFEST section */ "cache": [ - "index.html" + "index.html", + "app.js", + "resources/Rambox-all.css", + "resources/Icon.png" ], /** * List of items in the NETWORK section diff --git a/app/Application.js b/app/Application.js index bd670c5c..9ba8e597 100644 --- a/app/Application.js +++ b/app/Application.js @@ -26,6 +26,9 @@ Ext.define('Rambox.Application', { Ext.cq1('app-main').setActiveTab(key - 48); } }); + + // Remove spinner after 3 secs + Ext.defer(function() { Ext.get('spinner').destroy(); }, 3000); } ,updateTotalNotifications: function( newValue, oldValue ) { diff --git a/app/store/Services.js b/app/store/Services.js index b7de20d8..4db0a0bb 100644 --- a/app/store/Services.js +++ b/app/store/Services.js @@ -21,7 +21,6 @@ Ext.define('Rambox.store.Services', { ,listeners: { load: function( store, records, successful ) { if ( Ext.isEmpty(records) ) { - Ext.get('spinner').destroy(); Ext.cq1('app-main').add({ tabConfig : { xtype : 'tbfill' } }); return; } diff --git a/app/ux/WebView.js b/app/ux/WebView.js index 7b0ec7be..04a2ea02 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -83,9 +83,6 @@ Ext.define('Rambox.ux.WebView',{ webview.addEventListener("did-finish-load", function(e) { Rambox.app.setTotalServicesLoaded( Rambox.app.getTotalServicesLoaded() + 1 ); - if ( Rambox.app.getTotalServicesLoaded() === Ext.getStore('Services').getCount() && Ext.get('spinner') !== null ) { - Ext.get('spinner').destroy(); - } }); // Open links in default browser