W3C home > Mailing lists > Public > public-device-apis@w3.org > May 2013

[vibration] Proposal to update the "processing vibration patterns" algorithm (ACTION-628)

From: Kostiainen, Anssi <anssi.kostiainen@intel.com>
Date: Mon, 6 May 2013 12:17:15 +0000
To: "public-device-apis@w3.org" <public-device-apis@w3.org>
CC: Anne van Kesteren <annevk@annevk.nl>, Justin Lebar <justin.lebar@gmail.com>
Message-ID: <7FDA3EE0-14A9-4F36-83C8-AC8A2B494973@intel.com>
Hi All,

Thanks to Anne's and Justin's careful review and feedback (see the thread starting at [1]), we have a proposal on the table which improves the API keeping compatibility with the existing content.

Specifically, in this proposal vibrate() does not throw but returns a boolean instead. Below is the suggested new "processing vibration patterns" algorithm:

[[

1. Let pattern be the value of the first argument.

2. If pattern is a list, proceed to the next step. Otherwise run
 the following substeps:
 1. Let list be an initially empty list, and add pattern to
    list.
 2. Set pattern to list.

3. If any entry of pattern exceeds an implementation-dependent
 limit, then return false and terminate these steps.

4. If the length of pattern is even and is not zero, then remove
  the last entry in pattern.

5. If the length of pattern exceeds an implementation dependent
 limit, then return false and terminate these steps.

6. If the hidden attribute [PAGE-VISIBILITY] is set to true,
  then return false and terminate these steps.

[ Note 1 ]

7. An implementation may return false and terminate these steps.

[ Note 2 ]

8. Cancel the pre-existing instance of the processing vibration
 patterns algorithm, if any.

9. If pattern is an empty list, or if the device does not
  provide a vibration mechanism (or it is disabled), then return
  true and terminate these steps.

[NEW] Return true, and then continue running these steps
     asynchronously.

10. For each time in pattern, run the following substeps:
 1. If the index of time is even (the first entry has index 0),
    vibrate the device for time milliseconds.
 2. Otherwise wait for time milliseconds.

]]

For comparison, the old algorithm is at [2].

Please let us know if you have concerns with this change.

-Anssi

[1] http://lists.w3.org/Archives/Public/public-device-apis/2013Apr/0017.html
[2] http://dev.w3.org/2009/dap/vibration/#dfn-processing-vibration-patterns
Received on Monday, 6 May 2013 12:19:22 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:59 UTC