source: trip-planner-front/node_modules/@nodelib/fs.walk/out/providers/async.js@ 84d0fbb

Last change on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 895 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const async_1 = require("../readers/async");
4class 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 = [];
10 }
11 read(callback) {
12 this._reader.onError((error) => {
13 callFailureCallback(callback, error);
14 });
15 this._reader.onEntry((entry) => {
16 this._storage.push(entry);
17 });
18 this._reader.onEnd(() => {
19 callSuccessCallback(callback, this._storage);
20 });
21 this._reader.read();
22 }
23}
24exports.default = AsyncProvider;
25function callFailureCallback(callback, error) {
26 callback(error);
27}
28function callSuccessCallback(callback, entries) {
29 callback(null, entries);
30}
Note: See TracBrowser for help on using the repository browser.