cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject cordova-lib git commit: Add setGlobalPreference() to ConfigParser
Date Fri, 13 Mar 2015 14:52:25 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 4de450544 -> 24e9d8a49


Add setGlobalPreference() to ConfigParser


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/24e9d8a4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/24e9d8a4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/24e9d8a4

Branch: refs/heads/master
Commit: 24e9d8a492aa227cbe8b1a2373769cc2f63f114e
Parents: 4de4505
Author: Mark Koudritsky <kamrik@gmail.com>
Authored: Fri Mar 13 10:39:15 2015 -0400
Committer: Mark Koudritsky <kamrik@gmail.com>
Committed: Fri Mar 13 10:49:12 2015 -0400

----------------------------------------------------------------------
 cordova-lib/src/configparser/ConfigParser.js | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/24e9d8a4/cordova-lib/src/configparser/ConfigParser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/configparser/ConfigParser.js b/cordova-lib/src/configparser/ConfigParser.js
index ec6d28a..1f69e14 100644
--- a/cordova-lib/src/configparser/ConfigParser.js
+++ b/cordova-lib/src/configparser/ConfigParser.js
@@ -136,6 +136,14 @@ ConfigParser.prototype = {
     getGlobalPreference: function (name) {
         return findElementAttributeValue(name, this.doc.findall('preference'));
     },
+    setGlobalPreference: function (name, value) {
+        var pref = this.doc.find('preference[@name="service_worker"]');
+        if (!pref) {
+            pref = new et.Element('preference');
+            this.doc.getroot().append(pref);
+        }
+        pref.attrib.value = value;
+    },
     getPlatformPreference: function (name, platform) {
         return findElementAttributeValue(name, this.doc.findall('platform[@name=\'' + platform
+ '\']/preference'));
     },


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message