facebook

Vibrate User-Defined Number of Times? CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #335204 Reply

    Unknown Author
    Participant

    How does one vibrate the iOS device a user-defined number of times using navigator.notification.vibrate(###) for each instance?

    #335443

    support-michael
    Keymaster

    My thought is to construct a series of timers that will basically schedule vibrations and account for a small delay between each vibrate.

    Let’s say we need a series of 3 quick vibrations. For example 250ms vibration with a 250ms wait. Here is a snippet I hacked up – I haven’t run it yet

    
    var VIB_TIME=250, 
         WAIT_TIME=250;
    for (var i=0; i < 3; i++) {
      setTimeout( 
          function(){navigator.notification.vibrate(VIB_TIME)},  
          i * VIB_TIME +  i * WAIT_TIME);
    }
    #335447

    Unknown Author
    Participant

    That worked! Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Vibrate User-Defined Number of Times? CLOSED

You must be logged in to post in the forum log in