Re: Vibration: throwing and pause

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