Skip to content

A library wrapper for the Vibrate API. Available on recent mobile browsers.

Notifications You must be signed in to change notification settings

hootware/vibrate.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Vibrate.js

A simple library that gives easy to use methods of using the W3C Vibration API.

##Compatible browsers

At the moment it seems only Firefox beta for Android supports the Vibration API. Webkit have support in their nightly builds so any browsers using it will automatically be supported.

https://market.android.com/details?id=org.mozilla.firefox_beta&hl=en

##Download

https://raw.github.com/hootware/vibrate.js/master/vibrate.js

##Contributors

Ollie Parsley - http://twitter.com/ollieparsley

##Future plans

  • Haptic feedback (attach to the key press event)
  • Support the Gamepad API "rumble" feature when released
  • Any suggestions you have, place in the issues please :)

##Usage

Start

Start a vibration for a number of milliseconds

window.vibrate.start(<milliseconds>);

Example

//Vibrate for 2 seconds
window.vibrate.start(2000);

Stop

Stop any vibrations

window.vibrate.stop();

Morse code

Create morse code in vibrations from a string

window.vibrate.morse(<string>);

Example

//Vibrate SOS in morse code
window.vibrate.morse('sos');

About

A library wrapper for the Vibrate API. Available on recent mobile browsers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published