haptix: MacOS touchpad haptics
haptix
is only supported on MacOS.
You can install the project with npm/pnpm/yarn.
$ npm install haptix
$ pnpm install haptix
$ yarn install haptix
There's only one method!
const { perform, PerformanceTime, FeedbackPattern } = require("@haptix/core");
// or
import { perform, PerformanceTime, FeedbackPattern } from "@haptix/core";
perform(FeedbackPattern.Generic, PerformanceTime.Now);
Note that nothing will happen unless you're touching the touchpad.
There's an internal reverse-engineered API that's undocumented and may cause your app to be rejected from the Mac App Store. It's WAY stronger vibration, and it will work without the user touching the trackpad.
import { Actuation, internalApiPerform } from "./index.js";
internalApiPerform(Actuation.Strong);
Sure ok here is an unsafe Rust function that calls an undocumented FFI API with unknown parameters. This is likely to segfault :)
import { internalApiPerform } from "./index.js";
// unsafeInternalApiPerform(actuation: integer number, unknown1: integer number, unknown2: floating point number, unknown3: floating point number): void
unsafeInternalApiPerform(6, 0, 0.0, 0.0);
After cloning this repo, simply run
$ yarn build
This project was built using Node, Rust, and napi-rs.
To learn more about napi, see the napi documentation.
To learn more about Rust, see the Rust documentation.
To learn more about Node, see the Node documentation.