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.

resq.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.react$$ = exports.react$ = exports.waitToLoadReact = void 0;
  4. exports.waitToLoadReact = function waitToLoadReact() {
  5. window.resq.waitToLoadReact();
  6. };
  7. exports.react$ = function react$(selector, props, state, reactElement) {
  8. props = props || {};
  9. state = state || {};
  10. let element = window.resq.resq$(selector, reactElement);
  11. if (Object.keys(props).length) {
  12. element = element.byProps(props);
  13. }
  14. if (Object.keys(state).length) {
  15. element = element.byState(state);
  16. }
  17. if (!element.name) {
  18. return { message: `React element with selector "${selector}" wasn't found` };
  19. }
  20. return element.isFragment && element.node
  21. ? element.node[0]
  22. : element.node;
  23. };
  24. exports.react$$ = function react$$(selector, props, state, reactElement) {
  25. let elements = window.resq.resq$$(selector, reactElement);
  26. if (Object.keys(props).length) {
  27. elements = elements.byProps(props);
  28. }
  29. if (Object.keys(state).length) {
  30. elements = elements.byState(state);
  31. }
  32. if (!elements.length) {
  33. return [];
  34. }
  35. let nodes = [];
  36. elements.forEach(element => {
  37. const { node, isFragment } = element;
  38. if (isFragment) {
  39. nodes = nodes.concat(node || []);
  40. }
  41. else if (node) {
  42. nodes.push(node);
  43. }
  44. });
  45. return [...nodes];
  46. };