ios-haptics 0.0.4 → 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/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
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;
5
8
  error(): void;
6
9
  };
7
10
  //#endregion
8
- export { haptic };
11
+ export { haptic };
package/dist/index.js CHANGED
@@ -1,27 +1,36 @@
1
1
  //#region src/index.ts
2
+ /**
3
+ * A single haptic "click"
4
+ */
2
5
  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 {}
6
+ try {
7
+ const label = document.createElement("label");
8
+ label.ariaHidden = "true";
9
+ label.style.display = "none";
10
+ const input = document.createElement("input");
11
+ input.type = "checkbox";
12
+ input.setAttribute("switch", "");
13
+ label.appendChild(input);
14
+ document.head.appendChild(label);
15
+ label.click();
16
+ document.head.removeChild(label);
17
+ } catch {}
15
18
  };
19
+ /**
20
+ * Two rapid haptics (good for confirmation)
21
+ */
16
22
  haptic.confirm = () => {
17
- haptic();
18
- setTimeout(() => haptic(), 120);
23
+ haptic();
24
+ setTimeout(() => haptic(), 120);
19
25
  };
26
+ /**
27
+ * Three rapid haptics (useful for errors)
28
+ */
20
29
  haptic.error = () => {
21
- haptic();
22
- setTimeout(() => haptic(), 120);
23
- setTimeout(() => haptic(), 240);
30
+ haptic();
31
+ setTimeout(() => haptic(), 120);
32
+ setTimeout(() => haptic(), 240);
24
33
  };
25
34
 
26
35
  //#endregion
27
- export { haptic };
36
+ export { haptic };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ios-haptics",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "haptic feedback for ios safari",
5
5
  "keywords": [
6
6
  "haptic",