UNPKG

1.55 kBTypeScriptView Raw
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.dev/license
7 */
8import { JsonValue } from '@angular-devkit/core';
9import { JobDescription, JobHandler } from './api';
10export type JobStrategy<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue> = (handler: JobHandler<A, I, O>, options?: Partial<Readonly<JobDescription>>) => JobHandler<A, I, O>;
11/**
12 * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.
13 */
14export declare function serialize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(): JobStrategy<A, I, O>;
15/**
16 * Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.
17 * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
18 * is.
19 */
20export declare function reuse<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;
21/**
22 * Creates a JobStrategy that will reuse a running job if the argument matches.
23 * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
24 * is.
25 */
26export declare function memoize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;