UNPKG

880 BJavaScriptView Raw
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.FallbackRegistry = void 0;
11const rxjs_1 = require("rxjs");
12const operators_1 = require("rxjs/operators");
13/**
14 * A simple job registry that keep a map of JobName => JobHandler internally.
15 */
16class FallbackRegistry {
17 constructor(_fallbacks = []) {
18 this._fallbacks = _fallbacks;
19 }
20 addFallback(registry) {
21 this._fallbacks.push(registry);
22 }
23 get(name) {
24 return (0, rxjs_1.from)(this._fallbacks).pipe((0, operators_1.concatMap)((fb) => fb.get(name)), (0, operators_1.first)((x) => x !== null, null));
25 }
26}
27exports.FallbackRegistry = FallbackRegistry;