lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
45 lines (44 loc) • 1.69 kB
TypeScript
import { BaseLabel } from './BaseLabel.js';
import type { LabelProperties } from './BaseLabel.js';
import type { WidgetAutoXML } from '../xml/WidgetAutoXML.js';
import type { ObservableCallback } from '../state/ObservableCallback.js';
import type { Observable } from '../state/Observable.js';
/**
* A widget which displays a line of text.
*
* Similar to {@link Label}, except the observable attached to this label is
* watched; when its value changes, the displayed text is updated. The
* observable can also be swapped via the {@link LiveLabel#textSource}
* accessor.
*
* @category Widget
*/
export declare class LiveLabel extends BaseLabel {
static autoXML: WidgetAutoXML;
/**
* The current observable in this label. For internal use only, check
* {@link LiveLabel#textSource} for the public accessor.
*/
protected _textSource: Observable<string>;
/**
* The watch callback for the observable. For internal use only, used for
* cleaning up the watcher.
*/
protected _textWatcher: ObservableCallback<string> | null;
/**
* Does the displayed value need to be updated?
*/
private textDirty;
/**
* @param textSource - The observable to get the text for the label.
*/
constructor(textSource: Observable<string>, properties?: Readonly<LabelProperties>);
protected handlePreLayoutUpdate(): void;
/** The current text value. */
get currentText(): string;
/** The observable that is displayed in this label */
set textSource(textSource: Observable<string>);
get textSource(): Observable<string>;
protected handleAttachment(): void;
protected handleDetachment(): void;
}