cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject webworks commit: CB-5212 - Add preference "DiskCache" (enable/disable)
Date Mon, 06 Jan 2014 21:16:41 GMT
Updated Branches:
  refs/heads/master 9f93e17bc -> 37e9fc11c


CB-5212 - Add preference "DiskCache" (enable/disable)

This triggers the native webview caching which may improve app performance
when resources are not expected to change.


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/37e9fc11
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/37e9fc11
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/37e9fc11

Branch: refs/heads/master
Commit: 37e9fc11cde9dc3670083aa75fb7605326eb0066
Parents: 9f93e17
Author: Bryan Higgins <bhiggins@blackberry.com>
Authored: Mon Jan 6 16:18:16 2014 -0500
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Mon Jan 6 16:18:16 2014 -0500

----------------------------------------------------------------------
 .../bin/templates/project/cordova/lib/config-parser.js         | 4 ++++
 blackberry10/framework/lib/config/default.js                   | 1 +
 blackberry10/framework/lib/framework.js                        | 6 +++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/37e9fc11/blackberry10/bin/templates/project/cordova/lib/config-parser.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/config-parser.js b/blackberry10/bin/templates/project/cordova/lib/config-parser.js
index ea3e4bf..3fb87c8 100644
--- a/blackberry10/bin/templates/project/cordova/lib/config-parser.js
+++ b/blackberry10/bin/templates/project/cordova/lib/config-parser.js
@@ -587,6 +587,10 @@ function processCordovaPreferences(data, widgetConfig) {
             logger.warn(localize.translate("WARNING_WEBSECURITY_DISABLED"));
         }
 
+        // <preference name="diskCache" value="enable or disable" />
+        if (preference.diskcache) {
+            widgetConfig.enableDiskCache = (preference.diskcache === 'enable');
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/37e9fc11/blackberry10/framework/lib/config/default.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/config/default.js b/blackberry10/framework/lib/config/default.js
index 77ea4c1..b7e09c0 100644
--- a/blackberry10/framework/lib/config/default.js
+++ b/blackberry10/framework/lib/config/default.js
@@ -77,5 +77,6 @@ module.exports = {
     enableFormControl: true,
     enableChildWebView: true,
     enableWebSecurity: true,
+    enableDiskCache: false,
     enablePopupBlocker: false
 };

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/37e9fc11/blackberry10/framework/lib/framework.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/framework.js b/blackberry10/framework/lib/framework.js
index 5de045c..5b45d1b 100644
--- a/blackberry10/framework/lib/framework.js
+++ b/blackberry10/framework/lib/framework.js
@@ -108,8 +108,12 @@ var _self = {
             if (!config.enablePopupBlocker) {
                 qnx.webplatform.nativeCall('webview.setBlockPopups', webview.id, false);
             }
-            // Workaround for executeJavascript doing nothing for the first time
 
+            if (config.enableDiskCache) {
+                qnx.webplatform.nativeCall('webview.setEnableDiskCache', webview.id, 'true');
+            }
+
+            // Workaround for executeJavascript doing nothing for the first time
             webview.executeJavascript("1 + 1");
 
             url = url || config.content;


Mime
View raw message