idea-toolbox
Version:
IDEA's utility functions
48 lines (47 loc) • 1.13 kB
TypeScript
import { Resource } from './resource.model';
/**
* A limit counter.
*/
export declare class LimitCounter extends Resource {
/**
* The counter.
*/
counter: number;
/**
* The limit against which the counter moves.
*/
limit: number;
load(x: any): void;
/**
* Add a number to the counter; default: 1.
*/
add(number?: number, forceLimit?: boolean): void;
/**
* Substract a number to the counter; default: 1.
*/
subtract(number?: number, forceLimit?: boolean): void;
/**
* Reset the counter.
*/
reset(): void;
/**
* Whether the counter can increase.
*/
canAdd(): boolean;
/**
* Whether the counter can decrease.
*/
canSubtract(): boolean;
/**
* Whether the counter is closed to the limit, based on a percentage; default: 80.
*/
isCloseToLimit(maxPercentage?: number): boolean;
/**
* Whether the limit has been reached by the counter.
*/
limitReached(): boolean;
/**
* Whether the counter exceeds the limit or goes negative.
*/
exceeds(): boolean;
}