hootware / vibrate.js

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

Home Page:http://vibratejs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

http://vibratejs.com


Languages

Language:JavaScript 100.0%