21 lines
494 B
JavaScript
21 lines
494 B
JavaScript
var HapticsPlugin = {
|
|
HapticFeedback: function(duration) {
|
|
try {
|
|
if (navigator.vibrate) {
|
|
navigator.vibrate(duration);
|
|
return true;
|
|
}
|
|
return false;
|
|
} catch(e) {
|
|
console.error('Haptic feedback error:', e);
|
|
return false;
|
|
}
|
|
},
|
|
|
|
IsHapticSupported: function() {
|
|
return (navigator.vibrate) ? 1 : 0;
|
|
}
|
|
};
|
|
|
|
mergeInto(LibraryManager.library, HapticsPlugin);
|