import type { IResettableModel, ILabel, IValueModel } from '@zajno/common/models/types'; export interface IFlagModel extends IValueModel, IResettableModel { toggle: () => void; setTrue: () => boolean | void; setFalse: () => boolean | void; } export type IFlagModelReadonly = { readonly value: boolean; }; export type ILabeledFlagModel = IFlagModel & ILabel; export declare class FlagModel implements IFlagModel, IFlagModelReadonly { private _value; constructor(initial?: boolean); get value(): boolean; set value(value: boolean); /** override me to spy. * * WARNING: use `bind` to use as callback to preserve `this` context. Otherwise, use `onChange` method */ setValue(value: boolean): void; get isDefault(): boolean; /** @returns whether the value has changed */ setTrue: () => boolean; /** @returns whether the value has changed */ setFalse: () => boolean; /** Possible issue: if this method is used in trackable context (e.g. autorun), it might lead to an infinite loop */ toggle: () => void; /** just sets input value, useful as a callback */ onChange: (value: boolean) => void; reset: () => void; }