You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2013/07/30 23:32:27 UTC

git commit: added firefoxos vibration apis & configuration

Updated Branches:
  refs/heads/master 5c08769e8 -> ab5124b87


added firefoxos vibration apis & configuration


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/ab5124b8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/ab5124b8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/ab5124b8

Branch: refs/heads/master
Commit: ab5124b8757469e34c01bb7a020b9142675cd4c4
Parents: 5c08769
Author: Herm Wong <he...@gmail.com>
Authored: Tue Jul 30 14:32:02 2013 -0700
Committer: Herm Wong <he...@gmail.com>
Committed: Tue Jul 30 14:32:02 2013 -0700

----------------------------------------------------------------------
 plugin.xml                 | 12 ++++++++++++
 src/firefoxos/vibration.js | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/ab5124b8/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index efb6b10..3a7ea09 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -9,6 +9,18 @@
     <js-module src="www/vibration.js" name="notification">
         <merges target="navigator.notification" />
     </js-module>
+        
+    <!-- firefoxos -->
+    <platform name="firefoxos">
+        <config-file target="config.xml" parent="/*">
+            <feature name="Vibration">
+                <param name="firefoxos-package" value="Vibraton" />
+            </feature>
+        </config-file>                                         
+        
+        <source-file src="src/firefoxos/vibration.js" />
+        
+    </platform>
 
     <!-- wp7 -->
     <platform name="wp7">

http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/ab5124b8/src/firefoxos/vibration.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/vibration.js b/src/firefoxos/vibration.js
new file mode 100644
index 0000000..7299848
--- /dev/null
+++ b/src/firefoxos/vibration.js
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+module.exports = {
+
+    vibrate: function(milliseconds) {
+        console.log ("milliseconds" , milliseconds);
+
+        if (navigator.vibrate) {
+            navigator.vibrate(milliseconds);
+        } else {
+            console.log ("cordova/plugin/firefoxos/vibration, vibrate API does not exist");
+        }
+    }
+
+};
\ No newline at end of file