Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

executeAsyncScript.js 1.1KB

12345678910111213141516171819202122
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const executeAsyncScript_1 = __importDefault(require("../scripts/executeAsyncScript"));
  7. const utils_1 = require("../utils");
  8. const constants_1 = require("../constants");
  9. async function executeAsyncScript({ script, args }) {
  10. const page = this.getPageHandle(true);
  11. const scriptTimeout = this.timeouts.get('script') || 0;
  12. script = script.trim();
  13. if (script.startsWith('return (')) {
  14. script = script.slice(7);
  15. }
  16. if (script.startsWith('return')) {
  17. script = `(function () { ${script} }).apply(null, arguments)`;
  18. }
  19. const result = await page.$eval('html', executeAsyncScript_1.default, script, scriptTimeout, constants_1.SERIALIZE_PROPERTY, constants_1.SERIALIZE_FLAG, ...(await utils_1.transformExecuteArgs.call(this, args)));
  20. return utils_1.transformExecuteResult.call(this, page, result);
  21. }
  22. exports.default = executeAsyncScript;