Innovenergy_trunk/frontend/node_modules/testcafe-browser-tools/lib/api/bring-to-front.js

31 lines
3.7 KiB
JavaScript
Raw Normal View History

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const os_family_1 = __importDefault(require("os-family"));
const find_window_1 = __importDefault(require("./find-window"));
const exec_1 = require("../utils/exec");
const binaries_1 = __importDefault(require("../binaries"));
/**
* Brings the browser window on top of all other windows.
* @function
* @async
* @name bringWindowToFront
* @param {string | object} windowDescriptor - The title of the web page opened in the window or a descriptor returned by findWindow.
*/
async function default_1(windowDescriptor) {
var windowDescription = typeof windowDescriptor === 'string' ? await find_window_1.default(windowDescriptor) : windowDescriptor;
var bringWindowToFrontArguments = void 0;
if (os_family_1.default.win)
bringWindowToFrontArguments = [windowDescription.hwnd];
else if (os_family_1.default.linux)
bringWindowToFrontArguments = [windowDescription.windowId];
else if (os_family_1.default.mac)
bringWindowToFrontArguments = [windowDescription.processId, windowDescription.windowId];
else
return;
await exec_1.execFile(binaries_1.default.bringToFront, bringWindowToFrontArguments);
}
exports.default = default_1;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnJpbmctdG8tZnJvbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXBpL2JyaW5nLXRvLWZyb250LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsMERBQTJCO0FBQzNCLGdFQUF1QztBQUN2Qyx3Q0FBeUM7QUFDekMsMkRBQW1DO0FBRW5DOzs7Ozs7R0FNRztBQUNZLEtBQUssb0JBQVcsZ0JBQWdCO0lBQzNDLElBQUksaUJBQWlCLEdBQUcsT0FBTyxnQkFBZ0IsS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDLE1BQU0scUJBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFD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