- From: Anssi Kostiainen via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 15 Nov 2011 08:34:09 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/vibration
In directory hutz:/tmp/cvs-serv4214
Modified Files:
Overview.html
Log Message:
first stab at an Introduction, move mozVibrate API doc example to Examples
Index: Overview.html
===================================================================
RCS file: /sources/public/2009/dap/vibration/Overview.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Overview.html 14 Nov 2011 16:35:25 -0000 1.9
+++ Overview.html 15 Nov 2011 08:34:07 -0000 1.10
@@ -34,61 +34,12 @@
<section class="informative">
<h2>Introduction</h2>
- <p>
- This Editor's Draft is inspired by Mozilla's
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=679966">
- Web Vibrator prototype</a>. Below is an excerpt extracted from
- the
- <a href="https://bugzilla.mozilla.org/attachment.cgi?id=571161&action=diff#a/dom/interfaces/base/nsIDOMNavigator.idl_sec2">
- source code</a> to be more readily available:
- </p>
- <div class='example'>
- <pre class='example sh_javascript'>
- /**
- * Pulse the device's vibrator, if it has one. If the device does not have a
- * vibrator, this function does nothing.
- *
- * mozVibrate takes one optional argument. The argument specifies how long
- * to vibrate for, or it gives a pattern of vibrator-on/vibrator-off timings.
- *
- * If a vibration pattern is in effect when this function is called, this
- * call will overwrite the existing pattern, if this call successfully
- * completes.
- *
- * We handle the argument to mozVibrate as follows.
- *
- * - If the argument is undefined, null, 0, or the empty list, we cancel any
- * outstanding vibration pattern; that is, we stop the device from vibrating.
- *
- * - Otherwise, if the argument X is not a list, we treat it as though it's
- * the singleton list [X] and then proceed as below.
- *
- * - If the argument is a list (or if we wrapped it as a list above), then we
- * try to convert each element in the list to an integer, by first
- * converting it to a number and then rounding. If we cannot convert any
- * element to an integer, or if any of the integers are negative, we throw
- * an illegal value exception.
- *
- * This list of integers specifies a vibration pattern. Given a list of
- * numbers
- *
- * [a_1, b_1, a_2, b_2, ..., a_n]
- *
- * the device will vibrate for a_1 milliseconds, then be still for b_1
- * milliseconds, then vibrate for a_2 milliseconds, and so on.
- *
- * The list may contain an even or an odd number of elements, but if you
- * pass an even number of elements (that is, if your list ends with b_n
- * instead of a_n), the final element doesn't specify anything meaningful.
- *
- * We may throw an illegal value exception if the vibration pattern is too
- * long, or if any of its elements is too large.
- *
- */
- [implicit_jscontext]
- void mozVibrate([optional] in jsval aPattern);
- </pre>
- </div>
+ <p>
+ The Vibration API defines a means for web developers to
+ programmatically provide tactile feedback in a form of vibration. The
+ API is designed to tackle high-value use cases related to gaming, and
+ is not meant to be used as a generic notification mechanism.
+ </p>
</section>
<section id='conformance'>
@@ -270,7 +221,63 @@
<section class='informative'>
<h2>Examples</h2>
<p>
- Vibrate the device for 1 second:
+ This specification is inspired by Mozilla's
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=679966">
+ Web Vibrator prototype</a>. Below is an excerpt extracted from
+ the
+ <a href="https://bugzilla.mozilla.org/attachment.cgi?id=571161&action=diff#a/dom/interfaces/base/nsIDOMNavigator.idl_sec2">
+ source code</a> to be more readily available:
+ </p>
+ <div class='example'>
+ <pre class='example sh_javascript'>
+ /**
+ * Pulse the device's vibrator, if it has one. If the device does not have a
+ * vibrator, this function does nothing.
+ *
+ * mozVibrate takes one optional argument. The argument specifies how long
+ * to vibrate for, or it gives a pattern of vibrator-on/vibrator-off timings.
+ *
+ * If a vibration pattern is in effect when this function is called, this
+ * call will overwrite the existing pattern, if this call successfully
+ * completes.
+ *
+ * We handle the argument to mozVibrate as follows.
+ *
+ * - If the argument is undefined, null, 0, or the empty list, we cancel any
+ * outstanding vibration pattern; that is, we stop the device from vibrating.
+ *
+ * - Otherwise, if the argument X is not a list, we treat it as though it's
+ * the singleton list [X] and then proceed as below.
+ *
+ * - If the argument is a list (or if we wrapped it as a list above), then we
+ * try to convert each element in the list to an integer, by first
+ * converting it to a number and then rounding. If we cannot convert any
+ * element to an integer, or if any of the integers are negative, we throw
+ * an illegal value exception.
+ *
+ * This list of integers specifies a vibration pattern. Given a list of
+ * numbers
+ *
+ * [a_1, b_1, a_2, b_2, ..., a_n]
+ *
+ * the device will vibrate for a_1 milliseconds, then be still for b_1
+ * milliseconds, then vibrate for a_2 milliseconds, and so on.
+ *
+ * The list may contain an even or an odd number of elements, but if you
+ * pass an even number of elements (that is, if your list ends with b_n
+ * instead of a_n), the final element doesn't specify anything meaningful.
+ *
+ * We may throw an illegal value exception if the vibration pattern is too
+ * long, or if any of its elements is too large.
+ *
+ */
+ [implicit_jscontext]
+ void mozVibrate([optional] in jsval aPattern);
+ </pre>
+ </div>
+
+ <p>
+ In the following example the device vibrates for 1 second:
<div class='example'>
<pre class='example sh_javascript'>
// vibrate for 1 second
@@ -281,8 +288,8 @@
</pre>
</div>
<p>
- Vibrate the device for 1 second, be still for 0.5 seconds and vibrate
- again for 2 seconds:
+ In the following example the device vibrates for 1 second, is still for
+ 0.5 seconds, and vibrates again for 2 seconds:
</p>
<div class='example'>
<pre class='example sh_javascript'>
Received on Tuesday, 15 November 2011 08:34:16 UTC