cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [7/8] cordova-plugin-vibration git commit: static-ized MIN_DURATION and MAX_DURATION
Date Mon, 18 May 2015 22:33:31 GMT
static-ized MIN_DURATION and MAX_DURATION


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/commit/e9e96ff0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/e9e96ff0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/e9e96ff0

Branch: refs/heads/master
Commit: e9e96ff0a0f8d27db02f83dff8a03965bdddccd1
Parents: fd40079
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Mon May 18 15:00:44 2015 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Mon May 18 15:00:44 2015 -0700

----------------------------------------------------------------------
 src/wp/Vibration.cs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/e9e96ff0/src/wp/Vibration.cs
----------------------------------------------------------------------
diff --git a/src/wp/Vibration.cs b/src/wp/Vibration.cs
index a2af48b..5a3b0d9 100644
--- a/src/wp/Vibration.cs
+++ b/src/wp/Vibration.cs
@@ -30,6 +30,9 @@ namespace WPCordovaClassLib.Cordova.Commands
     {
 
         private static readonly int DEFAULT_DURATION = 200;
+        private static readonly int MAX_DURATION = 5000;
+        private static readonly int MIN_DURATION = 5;
+
         // bool used to determine if cancel was called during vibrateWithPattern
         private bool cancelWasCalled = false;
 
@@ -42,13 +45,13 @@ namespace WPCordovaClassLib.Cordova.Commands
                 string[] args = JSON.JsonHelper.Deserialize<string[]>(vibrateDuration);
 
                 msecs = int.Parse(args[0]);
-                if (msecs < 1)
+                if (msecs < MIN_DURATION)
                 {
-                    msecs = 1;
+                    msecs = MIN_DURATION;
                 }
-                else if (msecs > 5000)
+                else if (msecs > MAX_DURATION)
                 {
-                    msecs = 5000;
+                    msecs = MAX_DURATION;
                 }
             }
             catch (FormatException)


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


Mime
View raw message