r-ninja
Version:
r-ninja watches for changes in JSX expressions and updates UI with very less glue code.
30 lines (29 loc) • 765 B
TypeScript
export declare class WatchExpression {
fn: Function;
private onChange;
last: any;
expBody: string;
lastExecutionTime: number;
constructor(fn: Function, onChange: (prev: any, now: any) => any);
private getExpBody;
private execute;
private isEqual;
get value(): any;
check(): boolean;
}
export declare class Watcher {
static ROOT: Watcher;
expressions: WatchExpression[];
isActive: boolean;
parent: Watcher;
children: Watcher[];
isDestroyed: boolean;
private constructor();
check(): void;
create(): Watcher;
remove(child: Watcher): void;
destroy(): void;
clear(): void;
watch(fn: Function, onChange: (prev: any, now: any) => any): WatchExpression;
count(): number;
}