source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/testing/file-watching.js@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.WatcherNotifier = void 0;
11class WatcherDescriptor {
12 constructor(files, directories, callback) {
13 this.files = files;
14 this.directories = directories;
15 this.callback = callback;
16 }
17 shouldNotify(path) {
18 return true;
19 }
20}
21class WatcherNotifier {
22 constructor() {
23 this.descriptors = new Set();
24 }
25 notify(events) {
26 for (const descriptor of this.descriptors) {
27 for (const { path } of events) {
28 if (descriptor.shouldNotify(path)) {
29 descriptor.callback([...events]);
30 break;
31 }
32 }
33 }
34 }
35 watch(files, directories, callback) {
36 const descriptor = new WatcherDescriptor(new Set(files), new Set(directories), callback);
37 this.descriptors.add(descriptor);
38 return { close: () => this.descriptors.delete(descriptor) };
39 }
40}
41exports.WatcherNotifier = WatcherNotifier;
Note: See TracBrowser for help on using the repository browser.