Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
865 bytes
|
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.FallbackRegistry = void 0;
|
---|
11 | const rxjs_1 = require("rxjs");
|
---|
12 | const operators_1 = require("rxjs/operators");
|
---|
13 | /**
|
---|
14 | * A simple job registry that keep a map of JobName => JobHandler internally.
|
---|
15 | */
|
---|
16 | class FallbackRegistry {
|
---|
17 | constructor(_fallbacks = []) {
|
---|
18 | this._fallbacks = _fallbacks;
|
---|
19 | }
|
---|
20 | addFallback(registry) {
|
---|
21 | this._fallbacks.push(registry);
|
---|
22 | }
|
---|
23 | get(name) {
|
---|
24 | return rxjs_1.from(this._fallbacks).pipe(operators_1.concatMap((fb) => fb.get(name)), operators_1.first((x) => x !== null, null));
|
---|
25 | }
|
---|
26 | }
|
---|
27 | exports.FallbackRegistry = FallbackRegistry;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.