Skip to content

A vanilla javascript plugin to provide a simple access to Vibration API

Notifications You must be signed in to change notification settings

isaquediasm/shaker.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A vanilla javascript plugin to provide a simple access to Vibration API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published