Microsoft Surface Haptics Click Integration
by pedro_g_s
HTML
<html>
<body>
<button id="b">Activate Click Waveform</button>
<script>
document.querySelector('#b').addEventListener('pointerdown', function(e) {
console.log("Pointer down detected")
if (e.haptics) {
const WAVEFORM_CLICK = 0x1003;
const waveform = new HapticsPredefinedWaveform({
waveformId: WAVEFORM_CLICK
});
console.log("Triggering haptics click waveform")
e.haptics.play(waveform);
}
});
</script>
</body>
</html>