appium-android-driver
Version:
Android UiAutomator and Chrome support for Appium
32 lines • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WEBVIEWS_DETAILS_CACHE = void 0;
exports.toDetailsCacheKey = toDetailsCacheKey;
exports.getWebviewDetails = getWebviewDetails;
const lru_cache_1 = require("lru-cache");
/** @type {LRUCache<string, import('../types').WebViewDetails>} */
exports.WEBVIEWS_DETAILS_CACHE = new lru_cache_1.LRUCache({
max: 100,
updateAgeOnGet: true,
});
/**
*
* @param {import('appium-adb').ADB} adb
* @param {string} webview
* @returns {string}
*/
function toDetailsCacheKey(adb, webview) {
return `${adb?.curDeviceId}:${webview}`;
}
/**
* Retrieves web view details previously cached by `getWebviews` call
*
* @param {import('appium-adb').ADB} adb
* @param {string} webview
* @returns {import('../types').WebViewDetails | undefined}
*/
function getWebviewDetails(adb, webview) {
const key = toDetailsCacheKey(adb, webview);
return exports.WEBVIEWS_DETAILS_CACHE.get(key);
}
//# sourceMappingURL=cache.js.map