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.

elementstore.js 784B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. class ElementStore {
  4. constructor() {
  5. this._index = 0;
  6. this._elementMap = new Map();
  7. }
  8. set(elementHandle) {
  9. const index = `ELEMENT-${++this._index}`;
  10. this._elementMap.set(index, elementHandle);
  11. return index;
  12. }
  13. async get(index) {
  14. const elementHandle = this._elementMap.get(index);
  15. if (!elementHandle) {
  16. return elementHandle;
  17. }
  18. const isElementAttachedToDOM = await elementHandle.evaluate((el) => {
  19. return el.isConnected;
  20. });
  21. return isElementAttachedToDOM ? elementHandle : undefined;
  22. }
  23. clear() {
  24. this._elementMap.clear();
  25. }
  26. }
  27. exports.default = ElementStore;