new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Plugins and security · all subjects

haptics

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Haptics plugin: supported platforms

The haptics plugin provides haptic feedback and vibrations on Android and iOS. There are no standards or requirements for vibration support on Android, so the feedback APIs may not work correctly on some phones.

Haptics plugin: automatic setup

To automatically install the haptics plugin, use one of these commands from your project root: npm run tauri add haptics, yarn run tauri add haptics, pnpm tauri add haptics, deno task tauri add haptics, bun tauri add haptics, or cargo tauri add haptics.

Haptics plugin: manual setup steps

To manually set up the haptics plugin: (1) Run 'cargo add tauri-plugin-haptics --target "cfg(any(target_os = "android", target_os = "ios"))"' in the src-tauri folder. (2) Modify lib.rs to add '#[cfg(mobile)] app.handle().plugin(tauri_plugin_haptics::init());' inside the setup closure. (3) Install JavaScript bindings using npm install @tauri-apps/plugin-haptics, yarn add @tauri-apps/plugin-haptics, pnpm add @tauri-apps/plugin-haptics, deno add npm:@tauri-apps/plugin-haptics, or bun add @tauri-apps/plugin-haptics.

Haptics plugin: lib.rs initialization example

Example of initializing the haptics plugin in src-tauri/src/lib.rs: #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .setup(|app| { #[cfg(mobile)] app.handle().plugin(tauri_plugin_haptics::init()); Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); }

Haptics plugin: JavaScript API

The haptics plugin exports four main functions from @tauri-apps/plugin-haptics: vibrate(duration), impactFeedback(intensity), notificationFeedback(type), and selectionFeedback(). Import example: import { vibrate, impactFeedback, notificationFeedback, selectionFeedback } from '@tauri-apps/plugin-haptics';

Haptics plugin: JavaScript usage example

Example of using the haptics plugin in JavaScript: import { vibrate, impactFeedback, notificationFeedback, selectionFeedback, } from '@tauri-apps/plugin-haptics'; await vibrate(1); await impactFeedback('medium'); await notificationFeedback('warning'); await selectionFeedback();

Haptics plugin: required permissions

By default all potentially dangerous plugin commands are blocked. To enable haptics functionality, add these permissions to the capabilities configuration: haptics:allow-impact-feedback, haptics:allow-notification-feedback, haptics:allow-selection-feedback, and haptics:allow-vibrate.

Haptics plugin: capability configuration example

Example of enabling haptics permissions in src-tauri/capabilities/mobile.json: { "$schema": "../gen/schemas/mobile-schema.json", "identifier": "mobile-capability", "windows": ["main"], "platforms": ["iOS", "android"], "permissions": [ "haptics:allow-impact-feedback", "haptics:allow-notification-feedback", "haptics:allow-selection-feedback", "haptics:allow-vibrate" ] }

Give your agent this brain