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.1KB

1234567891011121314151617181920212223
  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];
  18. }
  19. res = res.filter(el => !!el && typeof el[constants_1.ELEMENT_KEY] === 'string');
  20. const elements = res.length ? await getElementObject_1.getElements.call(this, strategy, res) : [];
  21. return utils_1.enhanceElementsArray(elements, this, strategyName, 'custom$$', [strategyArguments]);
  22. }
  23. exports.default = custom$$;