EZ Web Audio / preventEventDefaults
Function: preventEventDefaults()
preventEventDefaults(
key):void
Defined in: index.ts:593
Prevent default behavior for common interaction events on an element.
Useful for piano keys or other interactive audio controls where you want to prevent text selection, context menus, and drag-and-drop behaviors.
Parameters
key
HTMLElement
HTML element to attach event prevention to
Returns
void
Example
typescript
import { preventEventDefaults } from 'ez-web-audio'
const pianoKey = document.getElementById('key-c4')
preventEventDefaults(pianoKey)