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

Re: Vibration: throwing and pause

From: Kostiainen, Anssi <anssi.kostiainen@intel.com>
Date: Tue, 16 Apr 2013 08:04:21 +0000
To: Justin Lebar <justin.lebar@gmail.com>, Anne van Kesteren <annevk@annevk.nl>
CC: "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <438A38F8-0855-4FE3-A5EB-BD64AFDA858C@intel.com>
Hi Justin, Anne,

On Apr 16, 2013, at 2:22 AM, Justin Lebar <justin.lebar@gmail.com> wrote:

>> * In step 10 say "run the following substeps asynchronously".
> 
> Is this well-defined?
> 
> Perhaps the right thing is to "spawn a task," but my network
> connection is too poor for me to look that up right now!


I believe we could also say "Run the remainder of these steps
asynchronously, and return true from the method." before the
step 10 and keep the current step 10 as is. Here's the full
algorithm with proposed changes applied:

[[

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. Let pattern be list.

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

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

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

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

[ Note 1 ]

7. An implementation may return false and abort the algorithm
   at this point.

[ Note 2 ]

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

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

[NEW] Run the remainder of these steps asynchronously, and return
      true from the method.

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 spin the event loop for time milliseconds.

]]

Let's try to hash this algorithm out in email first. Please
review the proposal and let me know if there are any bugs.

Thanks,

-Anssi
Received on Tuesday, 16 April 2013 08:05:10 UTC

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