@minto-ai/tools 1.0.55 → 1.0.56
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/browser/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ import { default as isAndroid } from './is-android';
|
|
|
3
3
|
import { default as isIos } from './is-ios';
|
|
4
4
|
import { default as isMobile } from './is-mobile';
|
|
5
5
|
import { default as isPc } from './is-pc';
|
|
6
|
-
|
|
6
|
+
import { default as waitForUserInteraction } from './wait-for-user-interaction';
|
|
7
|
+
export { copyText, isAndroid, isIos, isMobile, isPc, waitForUserInteraction };
|
package/dist/index.js
CHANGED
|
@@ -13252,6 +13252,47 @@ function isMobile() {
|
|
|
13252
13252
|
function isPc() {
|
|
13253
13253
|
return !isMobile();
|
|
13254
13254
|
}
|
|
13255
|
+
function waitForUserInteraction() {
|
|
13256
|
+
return new Promise(function(resolve2) {
|
|
13257
|
+
var audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
13258
|
+
if (audioContext.state === "running") {
|
|
13259
|
+
audioContext.close();
|
|
13260
|
+
resolve2(true);
|
|
13261
|
+
return;
|
|
13262
|
+
}
|
|
13263
|
+
var interactionEvents = ["click", "touchstart", "touchend", "keydown", "mousedown", "pointerdown"];
|
|
13264
|
+
var timeoutId = null;
|
|
13265
|
+
var isResolved = false;
|
|
13266
|
+
function handleInteraction() {
|
|
13267
|
+
if (isResolved) {
|
|
13268
|
+
return;
|
|
13269
|
+
}
|
|
13270
|
+
isResolved = true;
|
|
13271
|
+
if (timeoutId) {
|
|
13272
|
+
clearTimeout(timeoutId);
|
|
13273
|
+
}
|
|
13274
|
+
interactionEvents.forEach(function(eventType) {
|
|
13275
|
+
document.removeEventListener(eventType, handleInteraction);
|
|
13276
|
+
});
|
|
13277
|
+
resolve2(true);
|
|
13278
|
+
}
|
|
13279
|
+
timeoutId = setTimeout(function() {
|
|
13280
|
+
if (isResolved) {
|
|
13281
|
+
return;
|
|
13282
|
+
}
|
|
13283
|
+
isResolved = true;
|
|
13284
|
+
interactionEvents.forEach(function(eventType) {
|
|
13285
|
+
document.removeEventListener(eventType, handleInteraction);
|
|
13286
|
+
});
|
|
13287
|
+
resolve2(false);
|
|
13288
|
+
}, 1e4);
|
|
13289
|
+
interactionEvents.forEach(function(eventType) {
|
|
13290
|
+
document.addEventListener(eventType, handleInteraction, {
|
|
13291
|
+
passive: true
|
|
13292
|
+
});
|
|
13293
|
+
});
|
|
13294
|
+
});
|
|
13295
|
+
}
|
|
13255
13296
|
function isNumber(value) {
|
|
13256
13297
|
return typeof value === "number";
|
|
13257
13298
|
}
|
|
@@ -16181,5 +16222,6 @@ export {
|
|
|
16181
16222
|
throttle,
|
|
16182
16223
|
timeDelay,
|
|
16183
16224
|
updateFilePathQuery,
|
|
16184
|
-
useTheme
|
|
16225
|
+
useTheme,
|
|
16226
|
+
waitForUserInteraction
|
|
16185
16227
|
};
|