@optimizely/optimizely-sdk
Version:
JavaScript SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts
63 lines (62 loc) • 1.99 kB
TypeScript
/**
* Copyright 2024-2026, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncTransformer } from "../type";
import { Platform } from '../../platform_support';
export interface Repeater {
start(immediateExecution?: boolean): void;
stop(): void;
reset(): void;
setTask(task: AsyncTransformer<number, unknown>): void;
isRunning(): boolean;
}
export interface BackoffController {
backoff(): number;
reset(): void;
}
export declare class ExponentialBackoff implements BackoffController {
private base;
private max;
private current;
private maxJitter;
constructor(base: number, max: number, maxJitter: number);
backoff(): number;
reset(): void;
}
export declare class ConstantBackoff implements BackoffController {
private value;
constructor(value: number);
backoff(): number;
reset(): void;
}
export declare class IntervalRepeater implements Repeater {
private timeoutId?;
private task?;
private interval;
private failureCount;
private backoffController?;
private running;
constructor(interval: number, backoffController?: BackoffController);
isRunning(): boolean;
private handleSuccess;
private handleFailure;
private setTimer;
private executeTask;
start(immediateExecution?: boolean): void;
stop(): void;
reset(): void;
setTask(task: AsyncTransformer<number, void>): void;
}
export declare const __platforms: Platform[];