oro:haptics
Request optional Android semantic feedback while respecting the application’s saved preference and OS feedback settings. Other platforms reject enabled requests with ENOSYS; an accepted pulse is not proof of physical feedback.
Related guides#
Examples#
Use the application's saved opt-in when requesting Android feedback:
import { perform } from 'oro:haptics'
const enabled = localStorage.getItem('haptics-enabled') === 'true'
await perform('confirmation', { enabled })
API reference#
Module specifiers#
oro:haptics
TypeScript declarations#
These declarations are generated from the runtime's published TypeScript surface.
oro:haptics#
declare module "oro:haptics" {
/**
* @typedef {object} HapticOptions
* @property {boolean} [enabled=false] The application's saved user preference.
*/
/**
* Requests one feedback pulse. Android respects system/view preferences and
* suppresses pulses less than 100 ms apart. `true` means accepted by the view,
* not independently measured physical feedback. Other platforms reject `ENOSYS`.
* @param {'selection'|'confirmation'|'rejection'} kind
* @param {HapticOptions} [options]
* @returns {Promise<boolean>}
*/
export function perform(kind: "selection" | "confirmation" | "rejection", options?: HapticOptions): Promise<boolean>;
namespace _default {
export { perform };
}
export default _default;
export type HapticOptions = {
/**
* The application's saved user preference.
*/
enabled?: boolean;
};
}
See also#
Source repository · Edit this page · View Markdown