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.

async.js 906B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const async_1 = require("../readers/async");
  4. class AsyncProvider {
  5. constructor(_root, _settings) {
  6. this._root = _root;
  7. this._settings = _settings;
  8. this._reader = new async_1.default(this._root, this._settings);
  9. this._storage = new Set();
  10. }
  11. read(callback) {
  12. this._reader.onError((error) => {
  13. callFailureCallback(callback, error);
  14. });
  15. this._reader.onEntry((entry) => {
  16. this._storage.add(entry);
  17. });
  18. this._reader.onEnd(() => {
  19. callSuccessCallback(callback, [...this._storage]);
  20. });
  21. this._reader.read();
  22. }
  23. }
  24. exports.default = AsyncProvider;
  25. function callFailureCallback(callback, error) {
  26. callback(error);
  27. }
  28. function callSuccessCallback(callback, entries) {
  29. callback(null, entries);
  30. }