ios-haptics 0.0.3 → 0.0.5

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
@@ -1,4 +1,7 @@
1
1
  //#region src/index.d.ts
2
+ /**
3
+ * A single haptic "click"
4
+ */
2
5
  declare const haptic: {
3
6
  (): void;
4
7
  confirm(): void;
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  //#region src/index.ts
2
+ /**
3
+ * A single haptic "click"
4
+ */
2
5
  const haptic = () => {
3
6
  try {
4
7
  const label = document.createElement("label");
@@ -13,10 +16,16 @@ const haptic = () => {
13
16
  document.head.removeChild(label);
14
17
  } catch {}
15
18
  };
19
+ /**
20
+ * Two rapid haptics (good for confirmation)
21
+ */
16
22
  haptic.confirm = () => {
17
23
  haptic();
18
24
  setTimeout(() => haptic(), 120);
19
25
  };
26
+ /**
27
+ * Three rapid haptics (useful for errors)
28
+ */
20
29
  haptic.error = () => {
21
30
  haptic();
22
31
  setTimeout(() => haptic(), 120);
package/package.json CHANGED
@@ -1,25 +1,34 @@
1
1
  {
2
2
  "name": "ios-haptics",
3
- "version": "0.0.3",
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.5",
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
- "keywords": ["haptic", "ios", "feedback", "haptic-feedback", "taptic", "safari", "ios", "vibrate"],
23
- "type": "module",
24
- "types": "./dist/index.d.ts"
30
+ "devDependencies": {
31
+ "tsdown": "latest",
32
+ "typescript": "^5.8.3"
33
+ }
25
34
  }