Skip to content

Latest commit

 

History

History
49 lines (31 loc) · 1.66 KB

README.md

File metadata and controls

49 lines (31 loc) · 1.66 KB

Shaker.js

Shake.js is a vanilla javascript plugin to provide a simple access to Vibration API

Installation

Bower

bower install shakerjs

Include the shaker.js file into the index.html

How to use

// Create an instance of Shaker
var shaker = new Shaker();

// Start a continuous vibrations based on the passed speed and duration (ms)
shaker.continuousVibration({speed: 'fast', duration: 2000});

// Start a single vibration based on duration(ms).
shaker.vibrate(3000);

// Vibrate 'SOS' in Morse.
shaker.vibrate([100,30,100,30,100,200,200,30,200,30,200,200,100,30,100,30,100]); 

Browser Support

This library relies on Vibration API. And this API is supported in the following browsers.

Chrome Firefox Opera Safari IE
webkit ✔ 11+ ✔ Nope ✘ Nope ✘ Nope ✘

Contributing

Don't be shy, send a Pull Request! Here is how:

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D