Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.6 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 | */
|
---|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
10 | exports.createSyncHost = void 0;
|
---|
11 | const rxjs_1 = require("rxjs");
|
---|
12 | function wrapAction(action) {
|
---|
13 | return new rxjs_1.Observable((subscriber) => {
|
---|
14 | subscriber.next(action());
|
---|
15 | subscriber.complete();
|
---|
16 | });
|
---|
17 | }
|
---|
18 | function createSyncHost(handler) {
|
---|
19 | return new (class {
|
---|
20 | get capabilities() {
|
---|
21 | return { synchronous: true };
|
---|
22 | }
|
---|
23 | read(path) {
|
---|
24 | return wrapAction(() => handler.read(path));
|
---|
25 | }
|
---|
26 | list(path) {
|
---|
27 | return wrapAction(() => handler.list(path));
|
---|
28 | }
|
---|
29 | exists(path) {
|
---|
30 | return wrapAction(() => handler.exists(path));
|
---|
31 | }
|
---|
32 | isDirectory(path) {
|
---|
33 | return wrapAction(() => handler.isDirectory(path));
|
---|
34 | }
|
---|
35 | isFile(path) {
|
---|
36 | return wrapAction(() => handler.isFile(path));
|
---|
37 | }
|
---|
38 | stat(path) {
|
---|
39 | return wrapAction(() => handler.stat(path));
|
---|
40 | }
|
---|
41 | write(path, content) {
|
---|
42 | return wrapAction(() => handler.write(path, content));
|
---|
43 | }
|
---|
44 | delete(path) {
|
---|
45 | return wrapAction(() => handler.delete(path));
|
---|
46 | }
|
---|
47 | rename(from, to) {
|
---|
48 | return wrapAction(() => handler.rename(from, to));
|
---|
49 | }
|
---|
50 | watch() {
|
---|
51 | return null;
|
---|
52 | }
|
---|
53 | })();
|
---|
54 | }
|
---|
55 | exports.createSyncHost = createSyncHost;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.