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.

custom$.js 1.0KB

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const getElementObject_1 = require("../../utils/getElementObject");
  4. const utils_1 = require("../../utils");
  5. const constants_1 = require("../../constants");
  6. async function custom$(strategyName, strategyArguments) {
  7. const browserObject = utils_1.getBrowserObject(this);
  8. const strategy = browserObject.strategies.get(strategyName);
  9. if (!strategy) {
  10. throw Error('No strategy found for ' + strategyName);
  11. }
  12. if (!this.elementId) {
  13. throw Error(`Can't call custom$ on element with selector "${this.selector}" because element wasn't found`);
  14. }
  15. let res = await this.execute(strategy, strategyArguments, this);
  16. if (Array.isArray(res)) {
  17. res = res[0];
  18. }
  19. if (res && typeof res[constants_1.ELEMENT_KEY] === 'string') {
  20. return await getElementObject_1.getElement.call(this, strategy, res);
  21. }
  22. throw Error('Your locator strategy script must return an element');
  23. }
  24. exports.default = custom$;