ios-haptics 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ //#region src/index.d.ts
2
+ declare const haptic: {
3
+ (): void;
4
+ confirm(): void;
5
+ error(): void;
6
+ };
7
+ //#endregion
8
+ export { haptic };
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ //#region src/index.ts
2
+ const haptic = () => {
3
+ try {
4
+ const label = document.createElement("label");
5
+ label.ariaHidden = "true";
6
+ label.style.display = "none";
7
+ const input = document.createElement("input");
8
+ input.type = "checkbox";
9
+ input.setAttribute("switch", "");
10
+ label.appendChild(input);
11
+ document.head.appendChild(label);
12
+ label.click();
13
+ document.head.removeChild(label);
14
+ } catch {}
15
+ };
16
+ haptic.confirm = () => {
17
+ haptic();
18
+ setTimeout(() => haptic(), 120);
19
+ };
20
+ haptic.error = () => {
21
+ haptic();
22
+ setTimeout(() => haptic(), 120);
23
+ setTimeout(() => haptic(), 240);
24
+ };
25
+
26
+ //#endregion
27
+ export { haptic };
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "ios-haptics",
3
+ "version": "0.0.1",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.js",
6
+ "devDependencies": {
7
+ "tsdown": "latest",
8
+ "typescript": "^5.8.3"
9
+ },
10
+ "exports": {
11
+ ".": "./dist/index.js",
12
+ "./package.json": "./package.json"
13
+ },
14
+ "description": "haptic feedback for ios safari",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsdown",
20
+ "dev": "tsdown --watch"
21
+ },
22
+ "type": "module",
23
+ "types": "./dist/index.d.ts"
24
+ }