cs-element
Version:
Advanced reactive data management library with state machines, blueprints, persistence, compression, networking, and multithreading support
61 lines • 2.83 kB
TypeScript
/**
* Реализация менеджера реактивности и computed свойств
*/
import { EventEmitter } from 'eventemitter3';
import { ReactivityManager, ComputedProperty, ComputedFunction, ComputedConfig, ReactiveWatcher, WatchCallback, WatcherConfig, ReactiveRef, DependencyGraph, ReactivityStats, ReactivityConfig, ReactivityEvent, ReactivityEventCallback, ReactiveContext, ReactiveScope } from '../types/reactivity-interfaces';
export declare class ReactivityManagerImpl extends EventEmitter implements ReactivityManager {
private computedProperties;
private watchers;
private reactiveProperties;
private refs;
private scopes;
private config;
private currentlyComputing;
private notificationQueue;
private batchTimeout;
private statsInterval;
private memoryLeakCheckInterval;
private context;
private stats;
private notificationHistory;
constructor(config?: ReactivityConfig);
computed<T>(compute: ComputedFunction<T>, config?: ComputedConfig): ComputedProperty<T>;
watch(path: string | string[], callback: WatchCallback, config?: WatcherConfig): ReactiveWatcher;
unwatch(watcherId: string): boolean;
getComputedValue<T>(computedId: string): T | undefined;
createScope(parentId?: string): ReactiveScope;
runInScope<T>(scopeId: string, fn: () => T): T;
disposeScope(scopeId: string): void;
disposeComputed(computedId: string): void;
disposeWatcher(watcherId: string): void;
getCurrentContext(): ReactiveContext;
setParent(childId: string, parentId: string, type: 'computed' | 'watcher'): void;
getChildren(parentId: string, type?: 'computed' | 'watcher'): string[];
isDisposed(id: string, type: 'computed' | 'watcher'): boolean;
private disposeChildren;
private removeFromParent;
private checkMemoryLeaks;
invalidateComputed(computedId: string): void;
invalidateByPath(path: string[]): void;
notify(path: string[], newValue: any, oldValue: any): void;
private scheduleBatchNotification;
private processBatchNotifications;
private processNotification;
ref<T>(value: T): ReactiveRef<T>;
reactive<T extends object>(obj: T): T;
private createReactiveProxy;
private currentDependencyTracker;
private trackDependency;
private clearComputedDependencies;
getDependencies(computedId: string): string[];
getDependencyGraph(): DependencyGraph;
clear(): void;
getStats(): ReactivityStats;
private updateStats;
private estimateMemoryUsage;
private generateId;
private emitEvent;
onReactivityEvent(event: ReactivityEvent, callback: ReactivityEventCallback): void;
offReactivityEvent(event: ReactivityEvent, callback: ReactivityEventCallback): void;
}
//# sourceMappingURL=ReactivityManagerImpl.d.ts.map