Skip to content

Commit b20ac76

Browse files
committed
Log warning if vibrate is not supported
1 parent 3f4bda8 commit b20ac76

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Assets/Plugins/WebGL/WebTools/WebToolPlugins.jslib

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,18 @@ var WebGlPlugins =
172172
},
173173

174174
_Vibrate: function(durationInMs) {
175+
if (!navigator.vibrate) {
176+
console.warn("Vibration API is not supported in this browser.");
177+
return;
178+
}
175179
navigator.vibrate(durationInMs);
176180
},
177181

178182
_VibratePattern: function(durationsInMs, length) {
183+
if (!navigator.vibrate) {
184+
console.warn("Vibration API is not supported in this browser.");
185+
return;
186+
}
179187
var pattern = [];
180188
for (var i = 0; i < length; i++) {
181189
pattern.push(HEAP32[(durationsInMs >> 2) + i]);

0 commit comments

Comments
 (0)