ios-haptics 0.0.2 → 0.0.4

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.
package/README.md CHANGED
@@ -3,10 +3,12 @@
3
3
  A small JavaScript utility for triggering subtle haptic feedback on iOS devices,
4
4
  using a clever browser-specific quirk.
5
5
 
6
+ try it here: https://codepen.io/tijnjh/pen/KwpgPqB
7
+
6
8
  ## 🚀 Installation
7
9
 
8
10
  ```sh
9
- npm install ios-haptics
11
+ npm i ios-haptics
10
12
  ```
11
13
 
12
14
  ## 📦 Usage
package/dist/index.d.ts CHANGED
@@ -5,4 +5,4 @@ declare const haptic: {
5
5
  error(): void;
6
6
  };
7
7
  //#endregion
8
- export { haptic };
8
+ export { haptic };
package/dist/index.js CHANGED
@@ -1,27 +1,27 @@
1
1
  //#region src/index.ts
2
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 {}
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
15
  };
16
16
  haptic.confirm = () => {
17
- haptic();
18
- setTimeout(() => haptic(), 120);
17
+ haptic();
18
+ setTimeout(() => haptic(), 120);
19
19
  };
20
20
  haptic.error = () => {
21
- haptic();
22
- setTimeout(() => haptic(), 120);
23
- setTimeout(() => haptic(), 240);
21
+ haptic();
22
+ setTimeout(() => haptic(), 120);
23
+ setTimeout(() => haptic(), 240);
24
24
  };
25
25
 
26
26
  //#endregion
27
- export { haptic };
27
+ export { haptic };
package/package.json CHANGED
@@ -1,24 +1,34 @@
1
1
  {
2
2
  "name": "ios-haptics",
3
- "version": "0.0.2",
4
- "main": "./dist/index.js",
5
- "module": "./dist/index.js",
6
- "devDependencies": {
7
- "tsdown": "latest",
8
- "typescript": "^5.8.3"
9
- },
3
+ "version": "0.0.4",
4
+ "description": "haptic feedback for ios safari",
5
+ "keywords": [
6
+ "haptic",
7
+ "ios",
8
+ "feedback",
9
+ "haptic-feedback",
10
+ "taptic",
11
+ "safari",
12
+ "vibrate"
13
+ ],
14
+ "repository": "tijnjh/ios-haptics",
15
+ "author": "tijnjh",
16
+ "type": "module",
10
17
  "exports": {
11
18
  ".": "./dist/index.js",
12
19
  "./package.json": "./package.json"
13
20
  },
14
- "description": "haptic feedback for ios safari",
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
15
24
  "files": [
16
25
  "dist"
17
26
  ],
18
27
  "scripts": {
19
- "build": "tsdown",
20
- "dev": "tsdown --watch"
28
+ "build": "tsdown"
21
29
  },
22
- "type": "module",
23
- "types": "./dist/index.d.ts"
30
+ "devDependencies": {
31
+ "tsdown": "latest",
32
+ "typescript": "^5.8.3"
33
+ }
24
34
  }