ios-haptics 0.1.2 → 0.1.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/dist/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/package.json +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region src/index.d.ts
|
|
2
|
+
declare const supportsHaptics: boolean;
|
|
2
3
|
interface haptic {
|
|
3
4
|
/** @deprecated */
|
|
4
5
|
apply: never;
|
|
@@ -29,4 +30,4 @@ interface haptic {
|
|
|
29
30
|
}
|
|
30
31
|
declare const __haptic: haptic;
|
|
31
32
|
//#endregion
|
|
32
|
-
export { __haptic as haptic };
|
|
33
|
+
export { __haptic as haptic, supportsHaptics };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ios-haptics v0.1.
|
|
2
|
+
* ios-haptics v0.1.4
|
|
3
3
|
* tijn.dev
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
6
|
//#region src/index.ts
|
|
7
|
+
const supportsHaptics = typeof window === "undefined" ? false : window.matchMedia("(pointer: coarse)").matches;
|
|
7
8
|
function _haptic() {
|
|
8
9
|
try {
|
|
9
10
|
if (navigator.vibrate) {
|
|
10
11
|
navigator.vibrate(50);
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
14
|
+
if (!supportsHaptics) return;
|
|
13
15
|
const labelEl = document.createElement("label");
|
|
14
16
|
labelEl.ariaHidden = "true";
|
|
15
17
|
labelEl.style.display = "none";
|
|
@@ -52,4 +54,4 @@ _haptic.error = () => {
|
|
|
52
54
|
const __haptic = _haptic;
|
|
53
55
|
|
|
54
56
|
//#endregion
|
|
55
|
-
export { __haptic as haptic };
|
|
57
|
+
export { __haptic as haptic, supportsHaptics };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ios-haptics",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "haptic feedback for ios safari",
|
|
6
6
|
"author": "tijnjh",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,8 +32,6 @@
|
|
|
32
32
|
"dev": "tsdown --watch"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"tsdown": "latest"
|
|
36
|
-
"@antfu/eslint-config": "^5.3.0",
|
|
37
|
-
"eslint": "^9.35.0"
|
|
35
|
+
"tsdown": "latest"
|
|
38
36
|
}
|
|
39
|
-
}
|
|
37
|
+
}
|