This page demonstrates the ability to alert users via vibrations.
Note: The device must have the vibrate functionality.
Status: Not ready
This demo is using the cordova-plugin-vibration plugin. For more information click here:
var GSW = GSW || {};
GSW.Tests = GSW.Tests || {};
GSW.Tests.onDeviceReady = function() {
// Cordova is now initialized. Have fun!
console.log('Now running cordova-' + cordova.platformId + '@' + cordova.version);
GSW.Tests.vibrateOne = function() {
let duration = 1000;
navigator.vibrate(duration);
};
GSW.Tests.vibrateTwo = function() {
let duration = 2000;
navigator.vibrate(duration);
};
GSW.Tests.vibrateThree = function() {
let duration = 1000;
navigator.vibrate([duration, duration, duration]);
};
GSW.Tests.vibrateFour = function() {
let duration = 2000;
navigator.vibrate([duration, duration, duration]);
};
document.getElementById("1000").addEventListener("click", GSW.Tests.vibrateOne);
document.getElementById("2000").addEventListener("click", GSW.Tests.vibrateTwo);
document.getElementById("3000").addEventListener("click", GSW.Tests.vibrateThree);
document.getElementById("4000").addEventListener("click", GSW.Tests.vibrateFour);
}
document.addEventListener('deviceready', GSW.Tests.onDeviceReady, false);