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:
1.3 KB
|
Line | |
---|
1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { JsonValue } from '../../json/index';
|
---|
9 | import { Readwrite } from '../../utils/index';
|
---|
10 | import { JobDescription, JobHandler, JobName } from './api';
|
---|
11 | /**
|
---|
12 | * A JobDispatcher can be used to dispatch between multiple jobs.
|
---|
13 | */
|
---|
14 | export interface JobDispatcher<A extends JsonValue, I extends JsonValue, O extends JsonValue> extends JobHandler<A, I, O> {
|
---|
15 | /**
|
---|
16 | * Set the default job if all conditionals failed.
|
---|
17 | * @param name The default name if all conditions are false.
|
---|
18 | */
|
---|
19 | setDefaultJob(name: JobName | null | JobHandler<JsonValue, JsonValue, JsonValue>): void;
|
---|
20 | /**
|
---|
21 | * Add a conditional job that will be selected if the input fits a predicate.
|
---|
22 | * @param predicate
|
---|
23 | * @param name
|
---|
24 | */
|
---|
25 | addConditionalJob(predicate: (args: A) => boolean, name: string): void;
|
---|
26 | }
|
---|
27 | /**
|
---|
28 | * OnReady a dispatcher that can dispatch to a sub job, depending on conditions.
|
---|
29 | * @param options
|
---|
30 | */
|
---|
31 | export declare function createDispatcher<A extends JsonValue, I extends JsonValue, O extends JsonValue>(options?: Partial<Readwrite<JobDescription>>): JobDispatcher<A, I, O>;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.